asp.net.ph

DeletedRowInaccessibleException Class

System.Data Namespace


Represents the exception that is thrown when an action is attempted on a DataRow that has been deleted.

DeletedRowInaccessibleException Class Members

Collapse   Constructors

Visibility Constructor Parameters
public DeletedRowInaccessibleException ( )
public DeletedRowInaccessibleException ( String s )
public DeletedRowInaccessibleException ( String message , Exception innerException )

Remarks

To delete a DataRow, use the DataRow class' s Delete method. Once you have deleted a row, 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.

Example

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.

private void DeletedRowInaccessibleExceptionExceptionDemo ( ) {
   // create a DataTable with one column.
   DataTable myTable = new DataTable ( "myTable" );
   DataColumn myColumn = new DataColumn ( "col1" );
   myTable.Columns.Add ( myColumn );
   // add ten rows to the table.
   DataRow newRow;
   for ( int i = 0;i <10; i++ ) {
      newRow = myTable.NewRow ( );
      newRow [ "col1" ] = i;
      myTable.Rows.Add ( newRow );
  }
   myTable.AcceptChanges ( );
   try {
      // delete a row and try to read it.
      myTable.Rows [ 9 ].Delete ( );
      Response.Write ( myTable.Rows [ 9 ] [ "col1" ] );
  }
   catch ( DeletedRowInaccessibleException rowException ) {
      Response.Write ( "DeletedRowInaccessibleException" );
      Response.Write ( rowException.Message );
   }
}
  C# VB

See Also

BeginEdit   DataRow   DataRowState   Delete   Item   ItemArray   RowState Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph