Which would be quicker.
1) Looping a datareader and creating a custom rows and columns based populated datatable
2) Or creating a dataAdapter object and just
It's nice to have DataReader when you need for example show progress of loading data. In DataSet you can't do something in a middle of loading data.
On the other hand DataSet is all-in-one object. So DataSet is much slower. DataReader can give you additional boost in places in your code where data operation is very slow. In these places change it from DataSet to DataReader. DataReader also takes less space in memory.
Oh course it takes more time to code good DataReader, but it's worth it. For example when you play with images or music taken from database.
More on this topic in MSDN Magazine
Your option #1 would be slower. However, there's a better way to convert a datareader to a datatable than adding custom rows by hand:
DataTable dt = new DataTable();
using (SqlConnection conn = GetOpenSqlConnection())
using (SqlCommand cmd = new SqlCommand("SQL Query here", conn)
using (IDataReader rdr = cmd.ExecuteReader())
{
dt.Load(rdr);
}
I can't comment on the difference between this and using .Fill()
.