Results 1 to 5 of 5

Thread: RowFilter

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    RowFilter

    I am trying to filter my record base on Employee No. like this;

    Dim aFind As String
    aFind = InputBox("Enter a Employee No.", "Search for Employee No.")
    Dim dv As DataView = DataSet11.Employee.DefaultView
    dv.RowFilter = "empno='" & aFind & "'"

    But it has no reaction and it not working. Kindly teach me the correct syntax of RowFilter?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    VB Code:
    1. Dim aFind As String= InputBox("Enter a Employee No.", "Search for Employee No.")
    2. Dim filteredRows() As DataRow = DataSet11.Employee.Select("empno='" & aFind & "'")
    3. 'now filteredRows contains any rows that match the critieria

  3. #3
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Omit those ' from your filter string when you are filtering on numbers not text. So your code is correct except it should be like this:
    VB Code:
    1. dv.RowFilter = "empno=" & aFind

  4. #4
    Lively Member flog3941's Avatar
    Join Date
    Nov 2002
    Posts
    123
    I dont get it where to you use the filteredrows() at then?

  5. #5
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    in the above example filteredrows() is an array of DataRows containing the desired criteria.

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