Calling a Function which uses ado command object in ASP

pts.
Tags:
ASP
SQL
T-SQL
Hi... I am calling a function or sub if u may call it from within the same page. it works fine until i execute a ado command object. as soon as i put the execute statement in the page, all activites stop and the page doesnt execute any further from the line calling that function. can u help me plz? I use SQL server 2000 thru adodb from ASP page herez the code of my function: objRs_Check.CommandText = "sp_checksuppl" objRs_Check.CommandType=4 with objRs_Check .Parameters.Append objRs_Check.CreateParameter("accom_details_id",adInteger,adParamInput,6,xx) .Parameters.Append objRs_Check.CreateParameter("Result",adInteger,adParamoutput) .Execute() 'Execution of the page stops here''''************** End With set objRs_Check = nothing end Function

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hey,

From what I can tell, it appears that you are trying to make a parameterized based stored procedure call from a RecordSet object. In ADO you can’t do that, you have to make it through the Command object. You can make non-parameterized stored procedure calls through the Connection or Recordset objects.

Bob

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • IncredibleHolck
    RK, Can you provide more of your code, there seems to be some items missing. It has been a while, but it would help to see how you define the command object (the nomenclature you use is confusing ... it appears to be a command, but you've named it as a recordset). Where is your connection for this command? Most commands require an activeconnection or need a connection string in order to execute. Are you referencing something for the constants (adInteger, adParamInput)? If you put in some in-line error handling, what does it say?
    0 pointsBadges:
    report
  • Mkevlar
    You are not using an ADO recordset, but rather a SQL command. The example below works in our enviroment. We do it by calling a COM object with the following code. ... Dim objRs_Check as Command 'I have assumed this Set objRs_Check = New Command With objRs_Check .ActiveConnection = cnConn 'Your Connection .CommandType = adCmdStoredProc .CommandText = "sp_checksuppl" .CommandTimeout = 0 .Parameters.Append .CreateParameter("@accom_details_id", adInteger, adParamInput, 6, xx) .Execute End With set objRs_Check = Nothing ...
    0 pointsBadges:
    report
  • Timallard
    I think it's your parameters ... you need to use the Set keyword to create the parameter before appending it to the params collection: Set objParam1 = objRs_Check.CreateParameter("accom_details_id",adInteger,adParamInput,6,xx) Set objParam2 = objRs_Check.CreateParameter("Result",adInteger,adParamoutput) Then add them to the collection ... objRs_Check.Parameters.Append objParam1 objRs_Check.Parameters.Append objParam2
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following