C# DataRow Empty-check

后端 未结 11 1094
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 05:13

I got this:

 DataTable dtEntity = CreateDataTable();
 drEntity = dtEntity.NewRow();

Then I add data to the row (or not). Lots of code, real

11条回答
  •  -上瘾入骨i
    2020-12-15 06:03

    I prefer approach of Tommy Carlier, but with a little change.

    foreach (DataColumn column in row.Table.Columns)
        if (!row.IsNull(column))
          return false;
    
      return true;
    

    I suppose this approach looks more simple and bright.

提交回复
热议问题