DataReader is certainly the "fastest" way to get the data, but you also have
to consider what you are doing with it. If you are holding on to the data
over a period of time with only a DataReader to firehose over, you are
holding a connection open.
Loading into a DataTable may add a couple of milliseconds to the operation
but you can close the connection and allow it to return to the pool, and now
you have your data in a disconnected manner until the next time you need to
get it.
In the big scheme of things, with only 50 to 100 rows, we are talking mere
miliseconds here.
-- Peter
Recursion: see Recursion
site:
http://www.eggheadcafe.com
unBlog:
http://petesbloggerama.blogspot.com
BlogMetaFinder:
http://www.blogmetafinder.com
"Code Monkey" wrote:
DataTable loading a SqlDataReader (dt.Load())?
Vanilla DataTable using SqlDataAdapter
or SqlDataReader ?
or is there a better way using Generics? If so, how? Essentially I
want to get about 50-100 rows of data (2 columns) out of my database
and use this is serveral places without caching it as the data could
get updated several times during a period of 5 minutes and thus, needs
to be always up-to-date.
TIA
Dave