473,545 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 19698
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 CreateDataReade r 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 CreateDataReade r 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 CreateDataReade r which
creates a DataTableReader . I think that is the closest you get to an
SqlDataReade r.
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4731
by: Rod | last post by:
Thanks in advance. I have two listboxes on a single asp page. I am trying to use sqldatareader to populate both using two seperate sql stored procs. I can populate each box seperately using two different methods but when I try to populate them both no the same page I get "InvalidOperationException: Invalid attempt to FieldCount when...
4
9455
by: lakshmi | last post by:
Hi all, My requirement is I need to have three different recordsets open at the same time. Traversing through the 3 recordsets, I would check on the data and based on some rules, return an object from my function. Will it be efficient to use a SQLDataReader or a DataSet for this situation? I understand from the documentation that there...
13
2477
by: Adie | last post by:
Hi, is this not possible? public DataSet getDimensions() { } public SqlDataReader getDimensions() { }
1
4380
by: Paul Hobbs | last post by:
Hi Everyone, I am trying to implement a DataGrid that uses Custom paging, but the DataSource is a SQLDataReader, not a DataSet. I have seen examples that use the Fill method of a DataAdapter to only retrieve a page of data, eg: daCustomers.Fill(dsCustomers, (PageNum - 1) * intPageSize, intPageSize, "Customers") But I am having...
4
2880
by: Michael Carr | last post by:
I have a function that populates a class with values from a database. I'd like to pass into the function either a SqlDataReader or a DataRow, depending on which mechanism I'm using to retrieve data from the database. However, the two classes don't appear to have any common interfaces that would allow me to enumerate the fields. Yet, when you...
4
1400
by: Griff | last post by:
The MSDN article: Developing high-performance ASP.NET applications recommends using the SqlDataReader above using DataSets. One of the advantage of using DataSets over DataReaders is (as I understand it) that DataSets are preferred for n-tier architecture because they can be disconnected from the database.
8
1905
by: Jeff | last post by:
Hi - I'm having trouble Databinding a SQLDataReader to a DataGrid control. I have an ASP.NET web page accessing a SQL database. I've used VS to build the app and stored it in a directory of my localhost on my development machine. The database is on the web. When I run the app on the local machine, IE opens, loads my aspx page from...
1
2796
by: Simon1234 | last post by:
Below you will see my code to read data from a database and store it into a dataset. The first, commented code uses an SQLDataReader and the second, uncommented code uses the Fill method of the SqlDataAdapter. They both work perfectly, as long as I use a query that returns a small amount of data. When I use a query that returns all the data...
0
7475
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7409
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7918
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5981
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5341
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1897
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
715
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.