Problem in filter the Dataset value using wildcard like % ?

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

    #1

    Problem in filter the Dataset value using wildcard like % ?

    Hi,

    In our Project we use Dataset to load the Grid with Values.

    We have some criteria to filter the values to be shown in the Grid.
    For that we used the SELECT command to filter the Same Dataset.

    The SELECT Command we are using is as follows

    DS.Tables(0).Se lect("FieldName = '" & input value & "')

    Its Working fine in all situations except filter using % e.g. a%a%a.

    This SELECT command works fine with % in the following situations

    a) filter string as %%%%.
    b) filter string as a%%%%0.
    c) filter string as a%a

    Now only situation it fails is
    filter string like a%a%, a%a%a, a%a%%, ...

    we know very well that this filter strings are valid in the Database
    Query Where Conditions.

    we like to know that Is any specific reason why it is not working in
    Dataset ? or anything wrong in our Query approach.

    Let me know if anyone has some other solution for this situation
    or suggestions.

    Thanks in Advance
    Anandan k
  • Ken Tucker [MVP]

    #2
    Re: Problem in filter the Dataset value using wildcard like % ?

    Hi,

    I think you would be better off using the dataview's rowfilter
    method but either way you need to use Like instead of = for wildcards.

    DS.Tables(0).de faultview.rowfi lter = "FieldName Like '" & input value & "'

    Ken
    ---------------------
    "Anandan" <Anandan@discus sions.microsoft .com> wrote in message
    news:88FE3332-CD60-44B4-A9F3-087C611C724A@mi crosoft.com...
    Hi,

    In our Project we use Dataset to load the Grid with Values.

    We have some criteria to filter the values to be shown in the Grid.
    For that we used the SELECT command to filter the Same Dataset.

    The SELECT Command we are using is as follows

    DS.Tables(0).Se lect("FieldName = '" & input value & "')

    Its Working fine in all situations except filter using % e.g. a%a%a.

    This SELECT command works fine with % in the following situations

    a) filter string as %%%%.
    b) filter string as a%%%%0.
    c) filter string as a%a

    Now only situation it fails is
    filter string like a%a%, a%a%a, a%a%%, ...

    we know very well that this filter strings are valid in the Database
    Query Where Conditions.

    we like to know that Is any specific reason why it is not working in
    Dataset ? or anything wrong in our Query approach.

    Let me know if anyone has some other solution for this situation
    or suggestions.

    Thanks in Advance
    Anandan k


    Comment

    • Anandan

      #3
      Re: Problem in filter the Dataset value using wildcard like % ?

      Hi,

      Again i have face the same problem and the following message has come

      Error in Like operator: the string pattern '%a%a%' is invalid.


      Let me know if anyone has some other solution for this situation
      or suggestions.


      Thanks in Advance
      Anandan k


      "Ken Tucker [MVP]" wrote:
      [color=blue]
      > Hi,
      >
      > I think you would be better off using the dataview's rowfilter
      > method but either way you need to use Like instead of = for wildcards.
      >
      > DS.Tables(0).de faultview.rowfi lter = "FieldName Like '" & input value & "'
      >
      > Ken
      > ---------------------
      > "Anandan" <Anandan@discus sions.microsoft .com> wrote in message
      > news:88FE3332-CD60-44B4-A9F3-087C611C724A@mi crosoft.com...
      > Hi,
      >
      > In our Project we use Dataset to load the Grid with Values.
      >
      > We have some criteria to filter the values to be shown in the Grid.
      > For that we used the SELECT command to filter the Same Dataset.
      >
      > The SELECT Command we are using is as follows
      >
      > DS.Tables(0).Se lect("FieldName = '" & input value & "')
      >
      > Its Working fine in all situations except filter using % e.g. a%a%a.
      >
      > This SELECT command works fine with % in the following situations
      >
      > a) filter string as %%%%.[/color]
      b )filter string as a%%%
      [color=blue]
      > Now only situation it fails is
      > filter string like a%a%, a%a%a, a%a%%, ...
      >
      > we know very well that this filter strings are valid in the Database
      > Query Where Conditions.
      >
      > we like to know that Is any specific reason why it is not working in
      > Dataset ? or anything wrong in our Query approach.
      >
      > Let me know if anyone has some other solution for this situation
      > or suggestions.
      >
      > Thanks in Advance
      > Anandan k
      >
      >
      >[/color]

      Comment

      Working...