Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 ADO - Output Variables

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-02-22 : 15:06:39
I seem to be stuck retrieving output variables from ADO only after the recordset is closed.

I've got an instance in ASP where I'd like to know the return value before looping through the recordset.

Is there any way to get a return value / output parameter then open the recordset?

Sam

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-02-22 : 16:08:09
No.

What does the value give you? Why do you need it before you run through the recordset?

Within the stored procedure, you can do this:

SET NOCOUNT ON
SELECT @output_value AS OutputValue
SELECT * FROM RegularQuery


When you open your ADO recordset, the first recordset will contain the output value, use it as you need, then call the NextRecordset method to grab the actual recordset.

Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-02-22 : 20:00:00
I've wanted Output variables first on a couple of occastions. This time it was a count of the records in the set that had a particular attribute. If the count was zero, I would like to change the header before displaying the recordset in HTML.

The dual recordset solution will get the job done.

Sam

Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-02-22 : 20:18:55
If you use a client side disconnected recordset then the output variable will be available.

Set the activeconnection to nothing.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -