Several stored procedure calls (original introduction)

Source: Internet
Author: User
Tags dsn
Stored procedure 1, calling 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 Rs=cmc.exe or Cmd.execute

Set Rs=cmd. Execute ()

%>
2, a stored procedure for 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, an input parameter and an 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, an input parameter, an output parameter, and a 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")
%>



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.