DataReader Question

J

Jerry

Hi,

I have a question about a DataReader. In my business component I want to
create a DataReader from a stored procedure and pass it back to my UI
process control in which passes to to UI via a delegate to be loaded into a
combobox. My question is since DataReader keeps the connection open until
it is disposed is it better to use the DataReader instead of the DataSet?
Right now I use a DataSet however I really only need a datareader. Another
question I have when I bind a DataSet to a control is the DataSet still in
memory even if it goes out of scope?

Thanks
 
N

Nicole Calinoiu

Jerry,

Given that you're passing your data-bearing object across application tiers,
you're probably better off with a DataSet than a DataReader. Even if you're
not using remoting now, you might need to add it later on, and a DataReader
is not serializable, so a DataSet (which is serializable) is a better choice
if there's any possibility you might need this capability.

HTH,
Nicole
 
G

Greg

Remember, behind the scenes dataset uses a datareader..kind of. My advise,
use a DataSet. You are working with disconnected data and i see no need,per
your specs, to keep a connection open.
 
A

Anuradha

The dataset needn't be in the memory. You can destroy the
DS, after binding to the control.

Anu
 

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

Similar Threads


Top