SqlDataReader NextResult

J

Julian Hershel

If I have a datareader that receives two resultsets from a stored procedure,
is it possible to read the second one first, and return to the first
resultset to read it? To be more clear, I need to read the resultsets in
reverse order. Should I change my stored procedure to return the resultsets
in a specific order or can I do it directly in datareader?

Thank you.

Julian
 
W

William Ryan eMVP

That's a good question...I don't have my IDE in front of me but I know you
can't call .NextResult to get back to the first set. Logically though, I'd
just switch the order. I really doubt you can get back to the first one
without calling executereader again and that would just be a waste of
resources.
 
B

bruce barker

reader are forward only - no going back, so no you can't. change the proc,
or load them into datasets.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top