DataReader Question

  • Thread starter Thread starter Jerry
  • Start date Start date
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
 
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
 
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.
 
The dataset needn't be in the memory. You can destroy the
DS, after binding to the control.

Anu
 
Back
Top