SqlDataReader

  • Thread starter Thread starter jjy
  • Start date Start date
J

jjy

While the SqlDataReader is in use, the associated SqlConnection is busy
serving the SqlDataReader, and no other operations can be performed on the
SqlConnection other than closing it.

If I am looping the first dataset and I want to do some more SQL operations
such as getting other info from a database, what would be the best approach?

Thanks.
 
Hi,

the best option from network traffic standpoint would of course be to
minimize the need for separate queries e.g to query all you need at once and
as compact as possible, but that certainly is possible only to certain
level. If you need data from two or more tables, you could query them
separately and then join in-memory with DataSet which would be pretty fast,
but again of course causes more traffic than option where you do all in
procedure and return only the ready-made results. Without knowing more about
the scenario it is hard to say which is the best option.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

While the SqlDataReader is in use, the associated SqlConnection is busy
serving the SqlDataReader, and no other operations can be performed on the
SqlConnection other than closing it.

If I am looping the first dataset and I want to do some more SQL operations
such as getting other info from a database, what would be the best approach?

Thanks.
 
Back
Top