469,610 Members | 2,092 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

SqlDataReader from DataSet (DataTable)

Hi all

I have a DataSet with one table filled.
From this DataSet (DataTable), I need to create a SqlDataReader.

Does anybody knows how to do this ?
Is it possible ??

Thanks for any help.

Regards
Frank
Oct 9 '08 #1
4 18396
Frank Uray wrote:
I have a DataSet with one table filled.
From this DataSet (DataTable), I need to create a SqlDataReader.

Does anybody knows how to do this ?
Is it possible ??
Both DataSet and DataTable expose a method CreateDataReader which
creates a DataTableReader. I think that is the closest you get to an
SqlDataReader.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Oct 9 '08 #2
Hi Martin

Thank you for your answer.

I just have tried to use this,
but there is no way to convert DataReader to SqlDataReader ... :-((

Regards
Frank

"Martin Honnen" wrote:
Frank Uray wrote:
I have a DataSet with one table filled.
From this DataSet (DataTable), I need to create a SqlDataReader.

Does anybody knows how to do this ?
Is it possible ??

Both DataSet and DataTable expose a method CreateDataReader which
creates a DataTableReader. I think that is the closest you get to an
SqlDataReader.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Oct 9 '08 #3
Frank Uray wrote:
I just have tried to use this,
but there is no way to convert DataReader to SqlDataReader ... :-((
As I said, DataTableReader is the closest you get.

DataTableReader and SqlDataReader have a common base class,
DbDataReader. Depending on your needs you might be able to use that type
for your variables and that way handle both SqlDataReader and
DataTableReader with the same code.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Oct 9 '08 #4
Frank Uray wrote:
"Martin Honnen" wrote:
>Frank Uray wrote:
>>I have a DataSet with one table filled.
From this DataSet (DataTable), I need to create a SqlDataReader.

Does anybody knows how to do this ?
Is it possible ??
Both DataSet and DataTable expose a method CreateDataReader which
creates a DataTableReader. I think that is the closest you get to an
SqlDataReader.
I just have tried to use this,
but there is no way to convert DataReader to SqlDataReader ... :-((
A SqlDataReader reads data over the network in a SQLServer specific
format.

DataTableReader reads data from a .NET in memory data structure.

It is no surprise that you can not convert a DataTableReader to
a SqlDataReader.

Arne
Oct 10 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rod | last post: by
4 posts views Thread by lakshmi | last post: by
1 post views Thread by Paul Hobbs | last post: by
4 posts views Thread by Michael Carr | last post: by
4 posts views Thread by Griff | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.