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

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.
 
S

Scott M.

DataAdapters actually use DataReaders under the covers to do their read
operations, so you're not really comparing two different things here.
 
W

William \(Bill\) Vaughn

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)
-----------------------------------------------------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top