Re: ADO.NET cmd.ExecuteReader OUTPUT parameters

Russell Collins <[email protected]> Thu, 14 Jun 2007 08:30:28 -0500
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <[email protected]>
 From what I understand, you won't be able to access the Output
parameter until you are done with the DataReader.  One solution could be
to turn the output parameter into another recordset and make it the 2nd
one to be retrieved.  Example:

Select somevalue from firsttable

Select 'OutputValue'

Select somevalue from secondtable

Select somevalue from thirdtable

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Peter Osucha
Sent: Thursday, June 14, 2007 8:27 AM
To: Discussion relating to the specifics of the C# and Managed C++
languages
Subject: ADO.NET cmd.ExecuteReader OUTPUT parameters

It's been a while since I did this in VB6 - I can't seem to recall the
best way to go about it.  I have a SQLDataReader object being returned
from an ExecuteReader() method on a SqlCommand object that is calling a
stored procedure.=20

=20

The returned SQLDataReader contains 3 'Results' (it is returning 3
separate recordsets) and the stored procedure being called also updates
an OUTPUT parameter.  I need to know the OUTPUT parameter value before
processing the third of the 'Results'.  However, I can't get the updated
OUTPUT parameter until I close the DataReader - after which I cannot go
back and loop through the 3rd of the 'Results'.

=20

What is a solution to this problem, please ('m reluctantly hoping it
isn't to return a single value in a 'Result' between the current 2nd and
3rd results with a recordset having one value- that of the OUTPUT
parameter I want)?

=20

Peter


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com