The storage procedure ASP develops the BS architecture three layer system, for the small and medium structure system puts the business logic in the SQL Server's stored procedure to be a very good realization method, but does this has the inconvenience which the ASP client and the database stored procedure is coordinated between debugging.
In the actual development I wrote the following function, automatically send the ASP end to the database parameters out, automatically generate the SQL Server Query Analyzer rules of the Stored procedure execution command string, placed in the textarea control, can be copied from the page directly to the Query Analyzer for stored procedure debugging, Here is the program.
' ================================================================== '
Dim DSN ' Data Source
Dim storename ' Stored Procedure name
Dim con ' Connection Object
Dim cmd ' Command Object
Dim rs ' Recordset Object
Set Con=server.createobject ("ADODB. Connection ")
Con.open DSN
Set Cmd=server.createobject ("Adodb.command")
Set CMD. Activeconnection=con
cmd.commandtext= Storename
Cmd.commandtype=adcmdstoredproc
Cmd. Parameters.Append cmd. CreateParameter ("@State", adinteger,adparaminput,4)
Cmd. Parameters.Append cmd. CreateParameter ("@WhereT", advarchar,adparaminput,200)
Cmd. Parameters.Append cmd. CreateParameter ("@BranchType", advarchar,adparaminput,50)
CMD ("@State") = 1
CMD ("@WhereT") = "2"
CMD ("@BranchType") = "3"
GETPMT (cmd) ' Gets the parameters of the stored procedure
Set Rs=server. CreateObject ("Adodb.recordset")
Rs. CursorType =3
Rs. LockType =3
Rs. CursorLocation =3
Set Rs. Source =cmd
Rs. Open
' ====================================================== '
' Functions that form stored procedures
' ======================= '
' Input parameter a= command object
' ======================= '
Sub Getpmt (a)
B=a.commandtext
B=replace (b, "?", "")
B=replace (b, ",", "")
B=replace (b, "}", "")
B=replace (b, "{", "")
B=replace (b, "", "")
B=replace (b, "Call", "")
B=replace (b, "(", "")
B=replace (b, ")", "")
Response.Write "<center><table border=1 cellpadding =0 cellspacing =0 bordercolordark= #ffffff bordercolorlight= #cccc88 ><tr onclick= "&b&" style.display= ' ><td bgcolor= #cccc88 > ' & B & "</td></tr><tr id=" &b& "style=display:none><td>"
Response.Write "<textarea rows=6 cols=70 style= ' font-color: #ccc888; bgcolor: #ffffc ' > '
Response.Write b
For each element in A.parameters
C=element
C= "'" & Replace (C, "'", "" ") &" "
D=d & vbCrLf & element.name & "= & C &", "
Next
D=left (D,len (d)-1)
Response.Write D
Response.Write "</TEXTAREA></td></tr></table></center>"
End Sub