SQLDataReader question

  • Thread starter Thread starter CSharper
  • Start date Start date
C

CSharper

I have a common program where I have a method which make a sql
connection and then prepares a SqlDataReader that is passed to the
calling method. But in the common method, I have the connection close
method as well. So when the query runs the data reader has data but
after the close is called the data reader becomes null. Is there a way
I can preserver the data reader after closing the connection??

Thanks.
 
I have a common program where I have a method which make a sql
connection and then prepares a SqlDataReader that is passed to the
calling method. But in the common method, I have the connection close
method as well. So when the query runs the data reader has data but
after the close is called the data reader becomes null. Is there a way
I can preserver the data reader after closing the connection??

Thanks.

Found the answer, CommandBehaviour.
 
Yeah, you can use the enum.

Just know what you're doing. You actually don't want to keep it around (as
short as time as possible). <<( $.05 explanation)
 
Back
Top