C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Databinding »

To fetch rows from datatable more faster


Posted Date: 18 Nov 2008    Resource Type: Code Snippets    Category: Databinding
Author: Vinod ChattergeeMember Level: Silver    
Rating: 1 out of 5Points: 10



1.Declare a datatable

dim customerDt as datatable
customerDt =new datatable()

2.Put some sample data to the table (or you can dynamically load data to the datatable)

customerDt.Columns.add("TestName")
customerDt.Columns.add("TestAge")
customerDt.Columns.add("TestYear")

dim customerDr as datarow
customerDr =customerDt.newrow()
customerDr ("TestName")="Vinod"
customerDr ("TestAge")="25"
customerDr ("TestYear")="1983"
customerDt.Rows.Add(customerDr )


3.Now we are going to play with enumerator to fetch data

Dim rowcount As Integer = 0
Dim Enumerator As IEnumerator = customerDt.Rows.GetEnumerator

While Enumerator.MoveNext

response.write(customerDt.Rows.Item(rowcount).Item("TestName"))
response.write(customerDt.Rows.Item(rowcount).Item("TestAge"))
response.write(customerDt.Rows.Item(rowcount).Item("TestYear"))

rowcount = rowcount + 1

End While

4.Thats all.. check how faster it is...
NB: You can change and use it with your needs...





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Enumerator  .  Datatable  .  

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: Paging of Data list
Previous Resource: How to Navigate Records using VB.NET
Return to Discussion Resource Index
Post New Resource
Category: Databinding


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use