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 » Articles » .NET Framework »

How to filter data from a dataset or datatable


Posted Date: 11 Jul 2004    Resource Type: Articles    Category: .NET Framework
Author: Mary MathewMember Level: Bronze    
Rating: 1 out of 5Points: 7



Introduction

It is a common practise to retrieve data from tables which do not change often and keep them in an in memory dataset. You can filter this dataset in memory to retrieve the specific records you want and thus save load on the database server.

Sample Code

Dim table as DataTable = myDataset.Tables(0)

Dim rows as DataRow() = table.Select( "name like '%Mary%' order by LastModifiedTime" )


The above sample will retrieve all records filtered by name, in the order of LastModifiedTime. We can use any query condition to call the Select() method on the datatable object.

The Select() method will return an array of DataRow and you can iterate through the list of rows and fields.

Tables which have static data (data which do not change over a period of time) can be retrieved and stored in cache. And you can use this filter approach to retrieve the specific records from it. This will save traffic to the dabase server and also increase the performance of your application.



Responses

Author: Ravi Makwana    07 Oct 2004Member Level: Bronze   Points : 0
Thank u 4 ur valuable Help!!!


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

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: How to implement multiple interface in VB.NET
Previous Resource: The use of adapters in BizTalkServer2004
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use