Mavrick -
You are damn right, getting the items one by is a resource hog, especially
because it keeps the connection open until the last item is fetched.
But a dataset when filled, does essentially the same thing.
A Dataset's penalty is - a larger memory footprint, and the need to fill all
the data before you see the first row. Plusses are - once you have it, the
connection can be reused.
A DataReader's penalty is - keeping the connection open.
So if you have not tomes of data, and you need to do processing between rows
(including databinding), then a dataset is a better choice - since that
allows for better conn. pooling. (There are other reasons too - editability,
not forward only etc.).
But if you have a situation where streaming the data makes sense, then
datareader maybe a better choice.
If you have a situation where streaming doesn't make sense, and you have
tonnes of data, then using your custom business object to save the dataset
heavy footprint, and filling that from a datareader may make sense.
HTH
- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/