If you have a datatable and you want to delete rows that contains null value from datatable. To do this find the source code below:
foreach (var column in dt.Columns.Cast<DataColumn>().ToArray())
{
if (dt.AsEnumerable().All(dr => dr.IsNull(column)))
{
dt.Columns.Remove(column);
}
}
No comments:
Post a Comment