By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,337 Members | 2,234 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,337 IT Pros & Developers. It's quick & easy.

Can SqlDataReader be used against stored procedures that return multiple resultsets?

P: n/a
In order to avoid multiple trips to the database, I would like to fill
several tables in a DataSet with a single call to a stored procedure that
will return resultsets for the appropriate tables.

Can the SqlDataReader be used for this?
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Technically you could, but you probably don't want to. If the db you are
using supports batch commands, you could seperate them withe a ';' for
instance, and have x number of SQL Statements exectuted together. WHen the
query returns, you'll have the same number of tables as queries. Similarly,
your proc could have multiple select statements in it and you'll get the
same effect. To answer your question about the Reader though, yes, you
could do it there too but it'd be a lot more work b/c you'd need to walk the
colums and rows collections of the reader and build each table...in order to
get to the next Select command, use DataReader.NextResult.

HTH,

Bill
"Top Gun" <nf*@nospam.com> wrote in message
news:#0**************@TK2MSFTNGP10.phx.gbl...
In order to avoid multiple trips to the database, I would like to fill
several tables in a DataSet with a single call to a stored procedure that
will return resultsets for the appropriate tables.

Can the SqlDataReader be used for this?

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.