SqlDataReader NextResult

  • Thread starter Thread starter Julian Hershel
  • Start date Start date
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
 
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.
 
reader are forward only - no going back, so no you can't. change the proc,
or load them into datasets.

-- bruce (sqlwork.com)
 
Back
Top