SoFunction
Updated on 2025-04-08

ASP calls SQL SERVER storage program

ASP calls SQL SERVER storage program
Source   http:///vb/techniccolumn/?MainId=2&BoardId=asp&ItemId=%CA%FD%BE%DD%BF%E2%B2%D9%D7%F7&RecId=2216

Calling database stored procedures
<%
    Set Dataconn = ("") 
'Create a connection object
     "DSN=SinoTrans;SERVER=APP_SERVER;UID=sa;PWD=;APP=Microsoft(R) Developer Studio;WSID=APP_SERVER;Regional=Yes"
    Set cmdTemp = ("")
'Create a command object
    Set rst = ("") 
'Create a record set object
= "dbo.pd_test" 'Stored procedure name
     = 4 
'The command category is 4, denoted as a stored procedure
    Set  = Dataconn
    Set tmpParam = ("Return Value", 3, 4, 4)
     tmpParam
    Set tmpParam = ("@BeginDate", 135, 1, 16, riqi) 
'Create an input parameter object
     tmpParam
     cmdTemp, , 1, 3    
'Generate query results
%>
The stored procedure called here is pd_test, which is a standard method provided in ADO. However, there is a problem, that is, when there are more than two SELECT statements in the stored procedure, but it is logically impossible to execute at the same time, ADO will prompt you that there are too many SELECT statements in the stored procedure. The solution is to directly execute the stored procedure using the EXECUTE method of the CONNECTION object of ADO, as follows:
<%
    Set Dataconn = ("") 
'Create a connection object
     "DSN=SinoTrans;SERVER=APP_SERVER;UID=sa;PWD=;APP=Microsoft(R) Developer Studio;WSID=APP_SERVER;Regional=Yes"
    ss = "EXECUTE dbo.pd_test " & "'" & riqi1 & "'" 
    Set rs = (ss)
%>