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
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?
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
…
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