How to Bind GridView with DataReader.

Binding a large amount of data to a datagrid will take more time , to avoid the time delay of binding large amount of data we can use DataReader instead of DataSet or DataTable.By Default , Datareader is fast compared to DataSet or DataTable.

The following example shows how to bind GridView with DataReader.

SqlConnection Conn = new SqlConnection ("");
SqlCommand Comm = new SqlCommand("",Conn);

DataGrid1.DataSource = Comm.ExecuteReader();


Author: Kapil Dhawan17 Jun 2008 Member Level: Gold   Points : 2

Nice piece of code
Thanks for sharing your knowledge with us.
I hope to see more good code from your side

This code is going to help lots of guys to understand this concet too. as most of understand Grid can be bind with DS only