When using stored procedures in ASP, the error "Incorrect Parameter type, unacceptable range, or conflict with other parameters" is encountered.

Source: Internet
Author: User

Today, I need to help my colleagues change an ASP page. I have several SQL queries in it. On the ASP page, I think it is cool and inefficient. So I put the query in the SQL server storage process, however, I have never used ASP stored procedures before. I will find an example on the Internet:

Function getcameraurl (Conn, cameraid)

Const adw.storedproc = & h0004
Const advarchar = 200
Const adchar = 129
Const adinteger = 3
Const adparamunknown = & h0000
Const adparaminput = & h0001
Const adparamoutput = & h0002
Const adparaminputoutput = & h0002
Const adparamreturnvalue = & h0004

Dim URL
Set release test = server. Createobject ("ADODB. Command ")
With each test
. Activeconnection = Conn
. Commandtext = "[df1500]. [DBO]. [sp_getcameraconnectioninfo]"
. Commandtype = adcmdstoredproc
'. Commandtype = ad1_text
. Parameters. append parameter test. createparameter ("return", adinteger, adparamreturnvalue, 4)
. Parameters. append. createparameter ("@ camera_id", adinteger, adparaminput, 4, cameraid)
. Parameters. append. createparameter ("@ URL", advarchar, adparamoutput, 1024)
. Execute
Url =. parameters ("@ URL"). Value
End
Set Rule test = nothing
Getcameraurl = URL

End Function

But an error is found upon execution:

The parameter type is incorrect, is not within the acceptable range, or is in conflict with other parameters.The error occurs in this line.

. Commandtype = adcmdstoredproc

ASP is rarely used. This kind of prompt is confusing. I originally thought that adstoredproc is a well-defined internal thing. Other online experts say that this thing needs to be defined by themselves. Oh, I understand. After correctionCodeAs follows:

Const adw.storedproc = & h0004
Const advarchar = 200
Const adchar = 129
Const adinteger = 3
Const adparamunknown = & h0000
Const adparaminput = & h0001
Const adparamoutput = & h0002
Const adparaminputoutput = & h0002
Const adparamreturnvalue = & h0004

Function getcameraurl (Conn, cameraid)

Const adw.storedproc = & h0004
Const advarchar = 200
Const adchar = 129
Const adinteger = 3
Const adparamunknown = & h0000
Const adparaminput = & h0001
Const adparamoutput = & h0002
Const adparaminputoutput = & h0002
Const adparamreturnvalue = & h0004

Dim URL
Set release test = server. Createobject ("ADODB. Command ")
With each test
. Activeconnection = Conn
. Commandtext = "[df1500]. [DBO]. [sp_getcameraconnectioninfo]"
. Commandtype = adcmdstoredproc
'. Commandtype = ad1_text
. Parameters. append parameter test. createparameter ("return", adinteger, adparamreturnvalue, 4)
. Parameters. append. createparameter ("@ camera_id", adinteger, adparaminput, 4, cameraid)
. Parameters. append. createparameter ("@ URL", advarchar, adparamoutput, 1024)
. Execute
Url =. parameters ("@ URL"). Value
End
Set Rule test = nothing
Getcameraurl = URL

End Function

Related Article

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.