Dataset Vs DataReader

  • Thread starter Thread starter Sugavaneswaran
  • Start date Start date
S

Sugavaneswaran

hi all ,

I would like to know in which scenario u use Dataset & in which scenario use
of Datareader is recommended. ?
Pls see I do not want to know the differences between them.

Sugavaneswaran S
 
It depends what you want to do with the returned data. For
example if you are getting lots of rows back and are not
bounding it to a control then a DataReader is the best
route.
If you want to bound the data to a control say (Grid) then
you are better of using the DataAdapter.Fill method

If you want to write the data straight to an XML File then
use XMLWriter.

Hope this gives you some idea.
 
Hi,

As other poster suggested, you might use DataReader when you don't need to
store data.
Otherwise use dataset/dataadapter (dataadapter uses DataReader behind the
scenes, btw).
 
In addition to what's been said, the DataReader is a forward only cursor. If
you need random access to the data, the DataReader is not the correct tool,
although you can move the data inot an array fairly efficiently
 
Ah... but you CAN use the DataReader to fetch "random" rows from a database.
But sure, once the data is fetched you have to save it somewhere or throw it
away. The DataReader is simply the low-level data interface.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top