Strongly Typed DateSets/DataTables and DataReaders

  • Thread starter Siegfried Heintze
  • Start date
S

Siegfried Heintze

As I recall, data readers are much more efficient than DataAdapters.

Unfortunately, the code I am refactoring could really benefit from a VS
generated strongly bound DataRow but it is using a data reader. Is there a
way to make VS 2003 generate a strongly typed DataRow, DataTable or DataSet
that can be easily used with a DataReader? Actually all I really want is a
automatically generated strongly typed DataRow (based on a SQL query) that
can populate itself from a DataReader.

How can I do that?

Thanks,
Siegfried
 
W

William Vaughn

Ah, that's like saying a motor is less efficient than the electrical cord
used to run it.
The DataReader is the low-level mechanism used by the DataAdapter Fill
method to populate the DataTable(s).
Try to run a query that returns a single row (TOP 1) via a DataReader and
use the DataTable.Load to populate the DataRow from the DataReader.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
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