0 pts.
 Calling a Function which uses ado command object in ASP
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

Software/Hardware used:
ASKED: December 14, 2004  9:10 AM
UPDATED: December 15, 2004  3:44 PM

Answer Wiki:
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
Last Wiki Answer Submitted:  December 15, 2004  8:46 am  by  DominoBob   0 pts.
All Answer Wiki Contributors:  DominoBob   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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 pts.

 

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 pts.

 

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 pts.