很多人用了这种方法,把结果变成datatable
1 DataRow[] rows = dt.Select( "条件 ");
2 DataTable table = dt.Clone();
3 table.Clear();
4 foreach (DataRow row in rows)
5 {
6 table.ImportRow(row);
7 }
诸如此类吧,反正就是循环一次,把rows添加到新行里,原理都一样,
这里有个用dataview的方法,可以省去这个麻烦:
1 DataView dv = dt.DefaultView;
2 dv.RowFilter = "process_status=" + cmbProcess.SelectedValue.ToString();
3 dataGridView1.DataSource = dv;