Results 1 to 4 of 4

Thread: Dataset Records Filtering

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    May 2003
    Posts
    53

    Talking 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

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Yes you can filter by using a DataView.

  3. #3

    Thread Starter
    Member
    Join Date
    May 2003
    Posts
    53
    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

  4. #4
    Addicted Member
    Join Date
    Aug 2003
    Posts
    153
    Check out MSDN for better examples. But here is one

    VB Code:
    1. Dim myView As New DataView(myTable, "Name = 'Jim', "", DataViewRowState.CurrentRows)
    2.  
    3. Dim currentRow As DataRowView
    4.  
    5. For Each currentRow In myView
    6. 'Display however you like using currentRow
    7. Next
    8.  
    9. 'To change the filter from Name = 'Jim
    10. myView.RowFilter = "Name = 'Bob'"
    11. '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
  •  



Click Here to Expand Forum to Full Width