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