Asp stored procedure usage

Source: Internet
Author: User
Tags dsn
1. Call a stored procedure without parameters
<%
Set conn = server. CreateObject ("adodb. connection ")
Set cmd = server. CreateObject ("adodb. command ")
Strconn = "dsn = pubs; uid = sa; pwd"
Conn. Open strconn
Set cmd. ActiveConnection = conn
Cmd. CommandText = "{call nono }"
'Set rsw.cmc.exe cmd.exe cute
Set rs = cmd. Execute ()
%>
2. Stored procedure of an input parameter
<%
Set conn = server. CreateObject ("adodb. connection ")
Set cmd = server. CreateObject ("adodb. command ")
Strconn = "dsn = pubs; uid = sa; pwd"
Conn. Open strconn
Set cmd. ActiveConnection = conn
Cmd. CommandText = "{call oneinput (?)} "
Cmd. Parameters. Append cmd. CreateParameter ("@ aaa", adInteger, adParamInput)
Cmd ("@ aaa") = 100
Cmd. Execute ()
%>
3. One input parameter and one output parameter
<%
Set conn = server. CreateObject ("adodb. connection ")
Set cmd = server. CreateObject ("adodb. command ")
Strconn = "dsn = pubs; uid = sa; pwd"
Conn. Open strconn
Set cmd. ActiveConnection = conn
Cmd. CommandText = "{call oneinout (?,?)} "
Cmd. Parameters. Append cmd. CreateParameter ("@ aaa", adInteger, adParamInput)
Cmd ("@ aaa") = 10
Cmd. Parameters. Append cmd. CreateParameter ("@ bbb", adInteger, adParamOutput)
Cmd. Execute ()
Bbb = cmd ("@ bbb ")
%>
4. One input parameter, one output parameter, and one return value
<%
Set conn = server. CreateObject ("adodb. connection ")
Set cmd = server. CreateObject ("adodb. command ")
Strconn = "dsn = pubs; uid = sa; pwd"
Conn. Open strconn
Set cmd. ActiveConnection = conn
Cmd. CommandText = "{? = Call onereturn (?,?)} "
Cmd. Parameters. Append cmd. CreateParameter ("@ return_value", adInteger, adParamReturnValue)
Cmd. Parameters. Append cmd. CreateParameter ("@ aaa", adInteger, adParamInput)
Cmd ("@ aaa") = 10
Cmd. Parameters. Append cmd. CreateParameter ("@ bbb", adInteger, adParamOutput)
Cmd. Execute ()
Bbb = cmd ("@ bbb ")
Rrr = cmd ("@ return_value ")
%>
How to call SQL Stored Procedures in ASP
Www.lucky365.net 2002-2-7 auspicious 365
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.