Convert DataTable to DataReader

I am looking for a snippet of code which converts a DataTable to a DataReader in vb.net.
LVL 1
Howard BashSenior Software EngineerAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
You can create a DataTableReader using the CreateDataReader function

http://msdn.microsoft.com/en-us/library/system.data.datatable.createdatareader%28v=VS.90%29.aspx
0
 
DhaestConnect With a Mentor Commented:
What exactly do you want to do ? Read the datatable line by line ?

I don't think you can convert this. You'll need to change your implementation/desgin.

Datatable vs datareader
http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/a9104d3e-0736-433c-b403-39a33ac76d2d
0
 
Howard BashSenior Software EngineerAuthor Commented:
I have seen such code and am building a set of conversion functions and wanted to include this.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
deightonCommented:
a DataReader provides different functionality to a DataTable - a DataTable is a cache of data in memory, but a DataReader accesses data row-by-row.

A DataReader can sometimes be considered to be a performance saving over a DataTable, but its implementation has to be correctly designed into the code.  I'd be surprised if anyone had designed code to perform this for you automatically in a beneficial way.

But good luck!
0
 
Howard BashSenior Software EngineerAuthor Commented:
The url shows me how to make a dataReader from a datatable which is fine.  Unfortuanetly,  I cannot directly convert a DataReader to MySqlDataReader.
0
 
CodeCruiserCommented:
That is how it works. You can not convert a DataTable to a SQLDataReader. The SQLDataReader has to connect to a SQL Server DB.
0
 
deightonCommented:
so are you using MYSQL?  Is that the problem here, you want to know how to access MySql data?
0
 
Howard BashSenior Software EngineerAuthor Commented:
I'm okay with accessing the data.  It's creating a MySQLDataReader from a datatable that I am struggling with.
0
 
JesterTooConnect With a Mentor Commented:
You cannot create a MySQLDataReader from a DataSet or a DataTable... what you probably need is a DataTableReader.  a MySQLDataReader reads its data directly from a MySQL Connection (the database itself) and a DataTableReader reads its data from a .Net object (i.e. a DataTable).  There are many examples of creating/using a DataTableReader on the web but if you need a specific example just let us know.  BTW, a DataTableReader is a .net class and is not specific to any flavor of db.
0
 
Howard BashSenior Software EngineerAuthor Commented:
FIne explainations and useful links for further investingation.
0
All Courses

From novice to tech pro — start learning today.