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)
 

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

Back
Top