//去除dataTable空行
public DataTable RemoveEmpty(DataTable dt)
{
List<DataRow> removelist = new List<DataRow>();
for (int i = ; i < dt.Rows.Count; i++)
{
bool IsNull = true;
for (int j = ; 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 = ; i < removelist.Count; i++)
{
dt.Rows.Remove(removelist[i]);
}
return dt;
}
查阅资料:http://www.cnblogs.com/fuge/archive/2013/03/26/2981890.html
谢谢博主