Re: Command Object Output Parameter Undefined?
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Thu, 5 Oct 2006 10:11:03 -0400
gary.huntress@xxxxxxxxx wrote:
I'm trying to maintain some old ADO code and I'm having trouble
understanding how my command object is behaving. The command object
is calling a stored procedure. I set up a normal command and
connection object, then I create 2 input and one output parameter.
The output parameter is named "ReturnValue".
The thing I'm confused about is that if I call
Cmd.Execute()
Response.Write (Cmd.Parameters("ReturnValue"))
I get the proper ReturnValue, however if I call
rs1 = Cmd.Execute()
I assume you meant "set rs1 = Cmd.Execute()"
Response.Write (Cmd.Parameters("ReturnValue"))Return and output parameter values are not sent to the client until all
then ReturnValue is undefined. Nothing else in the code changes.
Why would capturing the returned recordset (whether I use it or not)
affect the parameters in the Cmd object?
resultsets generated by the procedure are consumed. This means that you
have to at least navigate to the last record of rs1 before attempting to
read the output parameter. This can be accomplished by using a
client-side cursorlocation for your recordset (assuming the procedure
returns a single resultset).
My SOP is to use GetRows to stuff the data from the recordset into an
array, close the recordset, then retrieve the output and return
parameter values, allowing me to immediately close the connection before
starting to process the data.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Follow-Ups:
- Re: Command Object Output Parameter Undefined?
- From: Ross McKay
- Re: Command Object Output Parameter Undefined?
- References:
- Command Object Output Parameter Undefined?
- From: gary.huntress@xxxxxxxxx
- Command Object Output Parameter Undefined?
- Prev by Date: Command Object Output Parameter Undefined?
- Next by Date: Re: Command Object Output Parameter Undefined?
- Previous by thread: Command Object Output Parameter Undefined?
- Next by thread: Re: Command Object Output Parameter Undefined?
- Index(es):
Relevant Pages
|
Loading