Reputation: 7768
I have a DataRow and I need to make sure that it contains no nulls; Came up with this, but I am not sure how to get the value from the DataColumn
foreach (DataColumn dc in dr.Table.Columns)
{
if (dc == null && !(dc.ColumnName.Equals("id")))
{
return false;
}
}
Upvotes: 0
Views: 261
Reputation: 6434
Table.Columns.Cast<DataColumn>().Where(col => col.ColumnName != "id").Any(col => dr[col] == DBNull.Value);
Upvotes: 3