BindingSource.Filter不能与'!='一起使用

时间:2022-05-02 03:06:38

I have a binding source and it has a column called Description and I want to exclude all rows that have their description set to 'x'.

我有一个绑定源,它有一个名为Description的列,我想排除所有描述设置为'x'的行。

I have tried:

我试过了:

bindingSource.Filter = "Description != ' + x;

That doesn't work. Does anyone know how to do a is not comparison for the binding source's filter? I couldn't find any help on MSDN.

这不起作用。有谁知道如何做一个不是比较绑定源的过滤器?我在MSDN上找不到任何帮助。

2 个解决方案

#1


Try <> instead of !=.

尝试<>而不是!=。

See this for more help:

有关更多帮助,请参阅此

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

#2


Try this:

bindingSource.Filter = String.Format("Description != '{0}'", x);

One other thing to try is using <> instead of != if the above does still not work.

另一件事是尝试使用<>而不是!=如果上面仍然不起作用。

#1


Try <> instead of !=.

尝试<>而不是!=。

See this for more help:

有关更多帮助,请参阅此

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

#2


Try this:

bindingSource.Filter = String.Format("Description != '{0}'", x);

One other thing to try is using <> instead of != if the above does still not work.

另一件事是尝试使用<>而不是!=如果上面仍然不起作用。