Usage of Stored Procedures

Source: Internet
Author: User

 

1 To 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 , 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 " )

% >  

From: http://goaler.xicp.net/Article/ShowArticle.asp? Id = 190

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.