DataTable如何去掉值全为NULL或者空的列
A B C
1 3
2 0
3
例如上面的DataTable,删除列B。有没有简单的方法~ DataTable
[解决办法]
select A,B from table1
[解决办法]
for(int i = t.Columns.Count - 1 ; i >= 0 ; i --)
{
foreach(DataRow r in t.Rows)
{
if(!r.IsNull(t.Columns[i]))
continue;
}
t.Columns.RemoveAt(i);
}