DataTable的select()方法 [英] Datatable Select() Method
本文介绍了DataTable的select()方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个DataGridView和数据源
是 dtCustomer
我只想内容过滤器网格基于搜索文本视图。
Itried下面的代码
I have a Datagridview and the Data Source
is dtCustomer
I just want to filter the content of grid view based on a search text.
Itried the following code
DataTable dtSearch = dtCustomer;
dtSearch.Select("cust_Name like '" + txtSearch.Text + "%'");
grvCustomer.DataSource = dtSearch;
但是,这是行不通的。
如果有任何身体知道请共享解决方案
But this is not working. If any body knows the solution please share.
推荐答案
试试这个:
dtSearch.DefaultView.RowFilter = "cust_Name like '" + txtSearch.Text + "%'";
和检查一切只以修边的文字被删除的空间。
And check whatever there is space to be removed by triming the text.
这篇关于DataTable的select()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文