Anyone notice how much faster DataAdapter.Fill() is than DataTable.Load(DataReader)?

  • Thread starter Thread starter 0to60
  • Start date Start date
0

0to60

I could have sworn I read MS documentation that said a data reader is the
fastest, most lightweight way to read in a table. However, I'm finding that
DataAdapter.Fill() is often up to 5x faster. Am I missing something?

Also, why isn't there an async DataAdapter.BeginFill() method? Here MS is
pushing DataSets on us so hard, and they fail to offer an async way of
filling them.
 
DataAdapters actually use DataReaders under the covers to do their read
operations, so you're not really comparing two different things here.
 
Yup, managing a DataReader on your own can be troublesome and expensive as
it takes so much more code. I like the new DataTable.Load method that does
what Fill does with more control over the creation of the DataReader.

Ah, you're right. The async ops in ADO.NET 2.0 (and 3.0) are only 1/2 done.
Only executing the query is done async--it does not return a single row so
you'll have to create a background worker thread to do it or fetch sync.

See async ops in my book.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
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.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
Back
Top