I’ve been coding with .NET since it came out of beta. That’s a long time and I should reexamine some of my assumptions to see if things changed.
One of my biggest assumptions is that datareader is faster than a dataset – http://www.sitepoint.com/dataset-datareader/
Is this still the case? Did anything change? I heard rumors there is something less “chatty” than datareaders now but can’t find any articles to back it up. The idea was that when i “readnext” I have to do a database round trip while the alternative grabs everything at once in a single trip.
Is there a faster alternative to datareader now or is the article above still correct?
For the record, when I have a datareader all I do is place row values into an object, place the object into a hashtable, read the next row, repeat, then close the connection. Any logic connecting objects can be done using the hashtables after the connections are closed (freeing up the pool as quickly as possible).
The underlying logic of filling a
DataSetvia aDbDataAdapterobject has not changed. It still uses aDbDataReaderto fill up the DataSet. So, by definition, using a DataReader for the operation you describe will still be more efficient.