C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...









How to Bind GridView with DataReader.


Posted Date: 11 Jun 2008    Resource Type: Code Snippets    Category: ASP.NET GridView

Posted By: Bharathi       Member Level: Diamond
Rating:     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();




Responses

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      
Popular Tags   What are tags ?   Search Tags  
GridView  .  DataReader  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Gridview Resizable column
Previous Resource: Using SqlBulkCopy to Add New Record into GridView
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET GridView


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design   Scripts

it support

Contact Us    Privacy Policy    Terms Of Use