Link to home
Create AccountLog in
Avatar of jazzIIIlove
jazzIIIloveFlag for Sweden

asked on

DataView.RowFilter alternative for regex [A-Z]

Hi there;

I am stuck in a rowfilter that should be using [A-K]* as regex, but simply, it gives an exception and find out that this kind of regex is not work for DataView. So, for such regex what is the workaround?

It's a VB example, though addresses to my problem:

http://bytes.com/topic/visual-basic-net/answers/378785-regular-expressions-dataview-rowfilter

Kind regards.
SOLUTION
Avatar of dj_alik
dj_alik

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of dj_alik
dj_alik

you cannot use regex in rowfilter

you must use linq or  looping  for you filtering needs.
Avatar of jazzIIIlove

ASKER

Ok, could you provide me an equivalent linq query for this very SQL query.

SELECT * FROM books WHERE bookID LIKE '[A-P]%';

Kind regards.
Please...any help?
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Hi;

Thanks for your contributions. :)

"Right after your code", I append the following lines as:

DataTable selection = query.CopyToDataTable();
myGrid.DataSource = selection;

or should I just append as below:
myGrid.DataSource = query;

Both seem working, but I couldn't decide, please note that I am new to linq to dataview.

Kind regards.