C# DataRow Empty-check

后端 未结 11 1108
佛祖请我去吃肉
佛祖请我去吃肉 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条回答
  •  暖寄归人
    2020-12-15 06:09

    Maybe a better solution would be to add an extra column that is automatically set to 1 on each row. As soon as there is an element that is not null change it to a 0.

    then

    If(drEntitity.rows[i].coulmn[8] = 1)
    {
       dtEntity.Rows.Add(drEntity);
    }
     else
     {
       //don't add, will create a new one (drEntity = dtEntity.NewRow();)
     }
    

提交回复
热议问题