Use of asp+ stored procedures

Source: Internet
Author: User
Calling a stored procedure 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


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.