Represents the exception that is thrown when an action is attempted on a DataRow that has been deleted.
Object
Exception
SystemException
DeletedRowInaccessibleException
[Visual Basic] Public Class DeletedRowInaccessibleException Inherits SystemException [C#] public class DeletedRowInaccessibleException : SystemException [C++] public __gc class DeletedRowInaccessibleException : public SystemException [JScript] public class DeletedRowInaccessibleException extends SystemException
To delete a DataRow, use the DataRow class's Delete method. Once you have deleted a row with the method, any attempts to manipulate it will generate the DeletedRowInaccessibleException.
The DeletedRowInaccessibleException is thrown when using one of the following properties or methods that attempt to get or set the value of a deleted DataRow:
Use the DataRow class's RowState to determine if a row has been deleted.
Namespace: System.Data
Assembly: System.Data.dll
The following example deletes a DataRow from a DataTable. A subsequent attempt to read a value from the deleted row causes the DeletedRowInaccessibleException to be thrown.
[Visual Basic]
Private Sub DeleteRow() ' Create DataTable with one DataColumn. Dim t As New DataTable Dim dc As New DataColumn Set dc.DataType = system.Type.GetType("System.Int32") t.Columns.Add dc Dim i As Integer ' Add 10 rows. Dim r As DataRow For i = 0 To 9 Set r = t.NewRow r(0) = i t.Rows.Add r Next t.AcceptChanges Try Dim removedRow As DataRow Set removedRow = t.Rows(9) removedRow.Delete Debug.Print removedRow.RowState Debug.Print removedRow(0) removedRow.AcceptChanges Catch delRowErr As System.Data.DeletedRowInaccessibleException Debug.Print "DeletedRowInaccessibleException", delRowErr.Message Finally Debug.Print "finished" End Try End Sub
DeletedRowInaccessibleException Members | System.Data Namespace | BeginEdit | DataRow | DataRowState | Delete | Item | ItemArray | RowState