1, call the stored procedure without parameters
<%
Set conn = server.createObject ("adoDb.connection")
SET cmd = server.createObject ("adodb.command")
StrConn = "DSN = PUBS; UID = SA; PWD"
Conn.open straconn
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 straconn
Set cmd.activeConnection = conn
cmd.commandtext = "{CALL OneInput (?)}"
cmd.parameters.Append Cmd.createParameter ("@ aaa", adINteger, adpaaminput)
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 straconn
Set cmd.activeConnection = conn
cmd.commandtext = "{CALL Oneinout (?,?)}"
cmd.parameters.Append Cmd.createParameter ("@ aaa", adINteger, adpaaminput)
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 straconn
Set cmd.activeConnection = conn
cmd.commandtext = "{? = CALL ANDRETURN (?,?)}"
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")
%>