Convert data table to data reader

In some situations you may need to convert your data table to data reader, suppose you have a Data table named dt and getDataFromDB() is a function that returns a data table, here is the steps to convert data table to data reader.

DataTable dt = new DataTable();
dt = getDataFromDB();
DataTableReader dtr;
dtr = dt.CreateDataReader();
while (dtr.Read())
{
   //Do your tasks
}

Posted via email from fenildesai's posterous

Convert data table to data reader Convert data table to data reader Reviewed by Fenil Desai on 8:19 PM Rating: 5

No comments:

Powered by Blogger.