ASP Debug Stored Procedures

Source: Internet
Author: User
ASP development of the BS architecture of the three-tier system, for small and medium-sized structure of the system to put business logic in the SQL Server stored process is a good way to implement, but do so there is an ASP client and database stored procedures between the debugging of inconvenient.
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, "(", "")

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.