Datatable Select() Method

前端 未结 8 1640
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-11 16:15

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 follow

8条回答
  •  粉色の甜心
    2020-12-11 16:41

    DataTable.Select returns array of row, but you are binding entire data table not filtered rows. use this way or DataView

    DataTable dtSearch =  dtCustomer;
    var filter = dtSearch.Select("cust_Name like '" + txtSearch.Text + "%'");
    grvCustomer.DataSource = filter.ToList();
    

提交回复
热议问题