0
votes

I am trying to set a filter to one column for two arguements to my bindingsource which is bound to a datagrid.

Here is the code I am using to try filter my two arguements:

string filter = string.Format("(Status LIKE '%Pending%') And (Status LIKE '%Progress%')");
bs.Filter = filter;

However, it doesn't seem to filter any results. But if I just use one arguement:

string filter = string.Format("(Status LIKE '%Pending%')");
bs.Filter = filter;

It filters correctly. Is there something I am missing to make it filter out two arguments instead of one?

1
Do you want to retrieve rows that have a status value that contains both "Pending" and "Progress"? Or do you want to retrieve rows that have a status value of either "Pending" or "Progress"? - Markus
You are using "And" operator which means "Status" must be both '%Pending%' and '%Progress%', at the same time. - DotNet Developer
I am trying to retrieve rows that contain both Pending and Progress. Would I need an OR operator instead? - Zack
Thanks guys I have sorted now. - Zack

1 Answers

0
votes
string filter = string.Format("(Status LIKE '%Pending%') Or (Status LIKE '%Progress%')");

Worked