How to filter the DataGridView using ComboBox

后端 未结 2 1733
广开言路
广开言路 2020-12-07 05:39

I need help on filtering my DataGridView using ComboBox

Here\'s my display code

cm = new SqlCommand();
cn = new SqlConnect         


        
2条回答
  •  青春惊慌失措
    2020-12-07 06:38

    If you need DataGridView data source always to be a DataTable as in my case.

    DataTable dt = (DataTable)dgv.DataSource;
    dgv.DataSource = dt.Select("IsActive = 1").CopyToDataTable();
    

提交回复
热议问题