|
-
May 12th, 2004, 04:55 AM
#1
Thread Starter
Member
Dataset Records Filtering
Hello
Is it possible to store the database records in the Dataset and than filter the records of the contents of the database. Example I have a dataset which connects to the Remote Oracle database and loads some data. Later I need to give the customer a option where by he can filter the records in the dataset without connecting to the Oracle Server. Since to connect the remote Oracle Server and process data is quite time consuming.
Syed Nadeemulla Hussaini
# I-2,C & FM Quater
Hutti Gold Mines Co Ltd.
Raichur Karnataka
INDIA
-
May 12th, 2004, 10:26 PM
#2
Frenzied Member
Yes you can filter by using a DataView.
-
May 12th, 2004, 11:31 PM
#3
Thread Starter
Member
Hello
Will U be more specific with a simple example
Syed Nadeemulla Hussaini
# I-2,C & FM Quater
Hutti Gold Mines Co Ltd.
Raichur Karnataka
INDIA
-
May 13th, 2004, 06:07 AM
#4
Addicted Member
Check out MSDN for better examples. But here is one
VB Code:
Dim myView As New DataView(myTable, "Name = 'Jim', "", DataViewRowState.CurrentRows)
Dim currentRow As DataRowView
For Each currentRow In myView
'Display however you like using currentRow
Next
'To change the filter from Name = 'Jim
myView.RowFilter = "Name = 'Bob'"
'Filter is now Name = 'Bob'
Check out MSDN for more info on Dataviews and Datarowviews.
By the way it is better to apply the filter in the constructor as a pose to using one of the other constructors and then filtering the data as it means that the view can contain all the filtered data as it is being constructed. Rather than applying a filter of nothing once, and then applying the filter you want. (Performance issue.)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|