views:

24

answers:

1

Hi, I have a method that gets a list of numbers and filters my datatable according to it.

I use this code:

string MyQuery = CreateQueryMethod(MyNumbersList);
MyDataTable.DefaultView.RowFilter = MyQuery;

But if I get an empty list, MyQuery is just: "" // (string.empty) and if RowFilter is an empty string it shows the entire datatable - not filtered at all.

I want the datatable to be filtered to nothing in this case (I don't want to see any rows) what do I give RowFilter in order to get an empty datatable?

+1  A: 

You can put a filter that is always false (e.g. column1 != column1).

Itay
Thanks :) that could work
Johnny