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")
%>