' Prompt when accessing a DataTable: Deleted rows cannot be accessedFor each Dr in mesh Part 1. DataTable.Rows
If IsNull (dr["ID"]) Then
showinformation ("ID cannot be empty")
End
End If
Next
as shown in this circular judgment, if the data in the mesh Part 1 has been deleted, that is called: mesh parts. Deletefocusedrow (), then an error is raised: The deleted cannot be accessed on the
workaround, add a judge to determine whether the row was deleted, and access the data in the row:
For each Dr in task relation person. DataTable.Rows
If Dr. Rowstate<>8 Then
If IsNull (dr["Personnel ID"]) Then
showinformation ("Please select all relationship types of the relationship person, do not need to right-click Delete.") ")
End
End If
End If
Next
The RowState attribute of the DR can be judged.
RowState attribute annotations:
//The line has been created but does not belong to any System.Data.DataRowCollection. System.Data.DataRow is immediately in this state when it is created, before it is added to the collection, or after it has been removed from the collection.
Detached = 1,
//The line has not changed since the last Call to System.Data.DataRow.AcceptChanges ().
unchanged = 2,
//The row has been added to System.Data.DataRowCollection, System.Data.DataRow.AcceptChanges () has not been called.
Added = 4,
//The line has been removed through System.Data.DataRow's System.Data.DataRow.Delete () method.
Deleted = 8,
//The line has been modified and System.Data.DataRow.AcceptChanges () has not been called.
Modified = +,
Original address: http://bbs.delit.cn/thread-654-1-1.html
Reprint please indicate the source;
Author: metric Technology http://www.delit.cn
Call the mesh part. Deletefocusedrow () loop access. Datatabel times wrong