Resources » Code Snippets » ASP.NET GridView

How to Bind GridView with DataReader.


Posted Date: 11-Jun-2008  Last Updated:   Category: ASP.NET GridView    
Author: Member Level: Gold    Points: 10



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();
DataGrid1.DataBind();


Did you like this resource? Share it with your friends and show your love!

Responses to "How to Bind GridView with DataReader."
Author: Kapil Dhawan    17 Jun 2008Member Level: Gold   Points : 2
Hello
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

Regards,
Kapil



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    More...
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India