Like operator is not working with Dataview.RowFilter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • neeraj

    #1

    Like operator is not working with Dataview.RowFilter

    Hi, all

    Could anny one give me help how can I use like operator with these data
    types "integer , datetime or boolean" in DataView.RowFil ter

    Actually when I try to get the data from dataview using rowfilter with
    like operator
    Its working fine when data type of searching column is "string" .

    But if data type is "integer , datetime or boolean" its throws
    error

    This is the code which works fine

    Dim dv As New DataView
    dv = dttblFullData.D efaultView
    dv.RowFilter = "first_name like 'lilly%'"
    dgData.DataSour ce = dv

    And this is not works fine

    Dim dv As New DataView
    dv = dttblFullData.D efaultView
    dv.RowFilter = "Employee_i d like '4552%'"
    dgData.DataSour ce = dv

    or

    Dim dv As New DataView
    dv = dttblFullData.D efaultView
    dv.RowFilter = "Birth_date like '08/12/2%'"
    dgData.DataSour ce = dv


    or

    Dim dv As New DataView
    dv = dttblFullData.D efaultView
    dv.RowFilter = "is_Deleted like 1"
    dgData.DataSour ce = dv


    thanks

  • Armin Zingler

    #2
    Re: Like operator is not working with Dataview.RowFil ter

    "neeraj" <neeraj.nav@gma il.comschrieb
    Hi, all
    >
    Could anny one give me help how can I use like operator with these
    data types "integer , datetime or boolean" in DataView.RowFil ter
    >
    Actually when I try to get the data from dataview using rowfilter
    with like operator
    Its working fine when data type of searching column is "string" .
    >
    But if data type is "integer , datetime or boolean" its throws
    error
    Like does not work with Integer, Datetime or Boolean. Like means that a
    string starts with the chars given. Integer, Datetime, Boolean are not
    made of chars, thus it doesn't work. The filter string can contain the
    Convert function, which might help. Have a look at the documentation of
    DataColumn.Expr ession.


    Armin

    Comment

    • RobinS

      #3
      Re: Like operator is not working with Dataview.RowFil ter

      You can't. But you can write your own filters.

      Instaed of "Employee_i d like '4552%'", "Employee_i d >= 45520
      and Employee_id < 45530" (unless it's more than 5 digits, in which
      I'd see if I could convert it a string and try the string compare).

      Or instead of "Birth_date like '08/12/2%',
      "Birth_Date >= '2000-Aug-12'"

      Robin S.
      ---------------------------
      "neeraj" <neeraj.nav@gma il.comwrote in message
      news:1169747657 .300907.6890@v4 5g2000cwv.googl egroups.com...
      Hi, all
      >
      Could anny one give me help how can I use like operator with these
      data
      types "integer , datetime or boolean" in DataView.RowFil ter
      >
      Actually when I try to get the data from dataview using rowfilter with
      like operator
      Its working fine when data type of searching column is "string" .
      >
      But if data type is "integer , datetime or boolean" its throws
      error
      >
      This is the code which works fine
      >
      Dim dv As New DataView
      dv = dttblFullData.D efaultView
      dv.RowFilter = "first_name like 'lilly%'"
      dgData.DataSour ce = dv
      >
      And this is not works fine
      >
      Dim dv As New DataView
      dv = dttblFullData.D efaultView
      dv.RowFilter = "Employee_i d like '4552%'"
      dgData.DataSour ce = dv
      >
      or
      >
      Dim dv As New DataView
      dv = dttblFullData.D efaultView
      dv.RowFilter = "Birth_date like '08/12/2%'"
      dgData.DataSour ce = dv
      >
      >
      or
      >
      Dim dv As New DataView
      dv = dttblFullData.D efaultView
      dv.RowFilter = "is_Deleted like 1"
      dgData.DataSour ce = dv
      >
      >
      thanks
      >

      Comment

      Working...