DataTable去掉空行
作者:互联网
protected DataTable RemoveEmpty(DataTable dt)
{
List
for (int i = 0; i < dt.Rows.Count; i++)
{
bool IsNull = true;
for (int j = 0; j < dt.Columns.Count; j++)
{
if (!string.IsNullOrEmpty(dt.Rows[i][j].ToString().Trim()))
{
IsNull = false;
}
}
if (IsNull)
{
removelist.Add(dt.Rows[i]);
}
}
for (int i = 0; i < removelist.Count; i++)
{
dt.Rows.Remove(removelist[i]);
}
return dt;
}
标签:空行,Count,Rows,IsNull,removelist,DataTable,int,去掉,dt 来源: https://www.cnblogs.com/zmldz/p/15204388.html