I agree with most of the approaches suggested. I've seen any number of very
tight (and some not so tight) routines to convert a DataReader stream to a
DataTable. There are several posted to the web. However, none of them has
outperformed the Fill method. Not only that, but in 80 days you'll be able
to use the DataTable.Load function to import a DataReader directly into a
DataTable or the DataSet.Load method to build multiple tables (from
multiple resultsets) from a single DataReader stream. I would not be
re-inventing the wheel at this point in time.
Consider that every single line of code you write will have to be debugged
and supported from this point forward in time. IMHO, the minuscule savings
in performance you'll achieve by converting a DataReader stream to a
DataTable are not worth the extra expense of having to maintain this code.
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Wilhelm Heramb said:
How can I get the entire row (current) from the SqlDataReader;
Some pseudo code:
DataRow row;
while (sqlDataReader.Read())
{
row = sqlDataReader[... and so forth...
dataTable.Rows.Add(row);
}
Above code is what I wish for...but I know it is impossible. Any ideas to
how to solve this and get the current row as a DataRow.
Andreas