Re: Error in RowFilter Like Operation
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 03/27/04
- Next message: Miha Markic [MVP C#]: "Re: Error in RowFilter Like Operation"
- Previous message: King Kong: "Error in RowFilter Like Operation"
- In reply to: King Kong: "Error in RowFilter Like Operation"
- Next in thread: Miha Markic [MVP C#]: "Re: Error in RowFilter Like Operation"
- Reply: Miha Markic [MVP C#]: "Re: Error in RowFilter Like Operation"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 27 Mar 2004 12:26:19 -0000
King Kong <kfnwNOSPMZZ@hotmail.com> wrote:
> I am facing misterious problem while setting up RowFilter property of
> DataView.
It's not that mysterious really :)
> It works find when i do
>
> dv.RowFilter = "StudentName like 'Dave'"
> or
> dv.RowFilter = "StudentName like '%Dave'"
>
> but it breaks up when i do
> dv.RowFilter = "StudentName like 'Da%v%e'"
> or use wild cards, or repeat the above case.
Yup. From the documentation for DataColumn.Expression (linked from
DataView.RowFilter):
<quote>
Both the * and % can be used interchangeably for wildcards in a LIKE
comparison. If the string in a LIKE clause contains a * or %, those
characters should be escaped in brackets ([]). If a bracket is in the
clause, the bracket characters should be escaped in brackets (for
example [[] or []]). A wildcard is allowed at the beginning and end of
a pattern, or at the end of a pattern, or at the beginning of a
pattern. For example:
"ItemName LIKE '*product*'"
"ItemName LIKE '*product'"
"ItemName LIKE 'product*'"
Wildcards are not allowed in the middle of a string. For example,
'te*xt' is not allowed.
</quote>
Basically, it's much more restrictive than SQL Server, which is fair
enough really, IMO. I just wish you could specify a delegate to use for
filtering, rather than just a text string. That would make it *much*
more powerful.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Miha Markic [MVP C#]: "Re: Error in RowFilter Like Operation"
- Previous message: King Kong: "Error in RowFilter Like Operation"
- In reply to: King Kong: "Error in RowFilter Like Operation"
- Next in thread: Miha Markic [MVP C#]: "Re: Error in RowFilter Like Operation"
- Reply: Miha Markic [MVP C#]: "Re: Error in RowFilter Like Operation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|