winform(c#)中datagridview怎么实现搜索功能?

来源:百度知道 编辑:UC知道 时间:2024/05/09 18:18:17
winform(c#)中datagridview怎么实现搜索功能?请详细说明怎样搜索器中的数据 谢谢

用****bindingsource.filter="customerName=John";
****bingingsource就是你的程序里面的那个,后面“”里面的是对sql搜索的条件。

如果用variable代替"John",例:
string getName=txtName.text;
****bindingsource.filter="customerName='"+getName+"'";

对BindSource进行操作,获取DataView,然后采用RowFilter进行过滤