BindingSource.Filter:组合多个过滤器C#Winforms

BindingSource.Filter:组合多个过滤器C#Winforms,c#,winforms,ms-access-2010,bindingsource,C#,Winforms,Ms Access 2010,Bindingsource,我正在编写一个钩住Access数据库的程序。我有3个搜索条件,我正在尝试合并。其中两个过滤器来自复选框,而第三个是搜索框。就个人而言,这三种方法效果很好。但是,当尝试连接过滤器时,它似乎只识别“CheckedSListFilter”。我已经测试了连接字符串的多次迭代,但没有任何运气。我希望这只是一个语法问题。谢谢你的帮助 string SFilter = CheckedSListFilter();// method returns string "S = 'w1' OR S =

我正在编写一个钩住Access数据库的程序。我有3个搜索条件,我正在尝试合并。其中两个过滤器来自复选框,而第三个是搜索框。就个人而言,这三种方法效果很好。但是,当尝试连接过滤器时,它似乎只识别“CheckedSListFilter”。我已经测试了连接字符串的多次迭代,但没有任何运气。我希望这只是一个语法问题。谢谢你的帮助

        string SFilter = CheckedSListFilter();// method returns string "S = 'w1' OR S = 'w2' OR S = 'w3'"
        string PFilter = CheckedPStatusFilter();//method returns string "PA = 'True' OR "PB = 'True'"
        string CFilter = comboBox_SearchFields.Text;
        string filter = CFilter + " LIKE '" + "*" + textBox_search.Text + "*" + "'";//returns "R LIKE '*g*'"

                BindingSource bs = this.projectBindingSource;
                bs.Filter =  filter+" AND "+"("+PFilter +" OR "+SFilter+")";

我自己解决了这个问题。操作规程把我绊倒了。最后做了这样的事情:bs.Filter=“(“+SFilter+”)”+”和“+”(“+PFilter+”)“+”和“+”(“+PFilter+””)”; 现在一切正常