asp+| stored procedures Call stored procedures in ASP
<!--must load the Adovbs.inc file, otherwise there will be an error-->
<!--#include file= "Adovbs.inc"-->
<%
Dim objcnn
Dim objcmd
Dim Rs
Const O_ID=112
'-----Set up the Connection object----------
Set Objcnn=server.createobject ("Adodb.connection")
Objcnn.open "Driver={sql Server};server=localhost;uid=sa;pwd=cncanet;database=check;"
'-----Establish the Command object-----------
Set Objcmd=server.createobject ("Adodb.command")
Objcmd.activeconnection=objcnn
objcmd.commandtext= "Order_tot_amt" ' specifies the name of the stored procedure
Objcmd.commandtype=adcmdstoredproc ' It is stored Procedure
'-----Prepare the parameters for stored procedure-------
ObjCmd.Parameters.Append _
Objcmd.createparameter ("o_id", adinteger,adparaminput,,o_id)
ObjCmd.Parameters.Append _
Objcmd.createparameter ("P_tot", adbigint,adparamoutput,,0)
'-----Execute the stored procedure----------------------
Objcmd.execute
'-----output parameters and processing results--------------
For each parm in Objcmd.parameters
Response.Write Parm.name & "=" & Trim (parm) & "<br>"
Next
%>
The above code is passed in Win2000+iis5.0+sql Server2000