Datatable Select() Method

前端 未结 8 1646
佛祖请我去吃肉
佛祖请我去吃肉 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:44

    You can do something like this.

    DataView dv1 = dtDefault.DefaultView; 
    dv1.RowFilter = "CusGroupId=1 and CustomerCode LIKE '"+txtCustomer.Text +"%'";  
    DataTable dt=dv1.ToTable();
    
    0 讨论(0)
  • 2020-12-11 16:47

    Try this:

    dtSearch.DefaultView.RowFilter = "cust_Name like '" + txtSearch.Text + "%'";  
    

    And check whatever there is space to be removed by triming the text.

    0 讨论(0)
提交回复
热议问题