Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning multiple recordsets

Status
Not open for further replies.

sexydog

Programmer
Jul 9, 2002
176
GB
Hi

I have a stored proc that returns multiple recordsets..
I am currently using the following code to move through different recordsets

set next_recordset = current_recordset.NextRecordset

this code is only working for one of my stored procs that returns 4 recordsets but it does not work for another stored proc that returns 6 recordsets...How can I move through different recordsets

 
A basic example of traversing through a recordset object with multiple recordsets looks like this:

Do While Not (recordset Is Nothing)
Do While Not (recordset.EOF)
<<Perform actions with the current recordset>>
recordset.MoveNext
Loop

' Move to next recordset
Set recordset = recordset.NextRecordset
Loop

This should work for 1 to nth number of recordsets.

Also make sure that your stored procedure returns the number of recordset you are expecting. This can be verified in query analyzer.

 
If it works for 4, but not for 6, then the problem is with the stored proc returning 6, not with the code that returns 4.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top