Error: Deleted row information cannot be accessed through the row

前端 未结 4 1767
一向
一向 2020-12-06 08:47

To whom this may concern, I have searched a considerable amount of time, to work a way out of this error

\"Deleted row information cannot be accessed

4条回答
  •  执念已碎
    2020-12-06 09:47

    In your "crashing if", you can check if the row is deleted before accessing it's values :

    if (ds.Tables[0].Rows[i].RowState != DataRowState.Deleted &&
        Convert.ToString(ds.Tables[0].Rows[i][0].ToString()) == value)
    {
        // blaaaaa
    }
    

    Also, I'm not sure why you ToString() the RowState instead of comparing it to DataRowState.Deleted.

提交回复
热议问题