我想创建一个方法,该方法将DataTable
作为参数,并在执行后返回一个DataTable
具体操作。
该操作是从传递的 DataTable
中获取那些在 Camp 列中具有 NULL
值的行。
public DataTable Filter(DataTable table)
{
return table;
}
有什么建议吗?
最佳答案
DataView
可用于对数据进行过滤,如下所示:
public DataTable Filter(DataTable table)
{
DataView view = new DataView(table);
view.RowFilter = "Camp IS NULL";
table = view.ToTable();
return table;
}
关于c# - "DATATABLE"的数据表过滤方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21670984/