Strongly Typed DateSets/DataTables and DataReaders
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
Date:Wed, 8 Aug 2007 12:33:13 -0600
Author:
|
Re: Strongly Typed DateSets/DataTables and DataReaders
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)
-----------------------------------------------------------------------------------------------------------------------
"Siegfried Heintze" wrote in message
news:%23gzbVqe2HHA.5116@TK2MSFTNGP04.phx.gbl...
> 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
>
Date:Wed, 8 Aug 2007 15:19:24 -0700
Author:
|