I pesonally wouldn't use a
DataReader
to bind to a
GridView
. I would use the reader to populate a
DataTable
and then bind the
GridView
to the
DataTable
Something like this
SqlConnection con = new SqlConnection("Your Connection String Here");
con.Open();
SqlCommand cmdQuery = new SqlCommand("Your Query Here", con);
SqlDataReader drQuery = cmdQuery.ExecuteReader();
DataSet dsQuery = new DataSet();
DataTable dtQuery = new DataTable();
dsQuery.Tables.Add(dtQuery);
dsQuery.Load(drQuery, LoadOption.PreserveChanges, dsQuery.Tables[0]);
DataGridView1.DataSource = dsQuery.Tables[0];
Happy Coding.