asp.net.ph

VersionNotFoundException Class

System.Data Namespace


Represents the exception that is thrown when attempting to return a version of a DataRow that has been deleted.

VersionNotFoundException Class Members

Collapse   Constructors

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

Example

The following example initializes a DataTable with one DataColumn and ten DataRow objects. After deleting a DataRow, attempting to return the removed row' s current version results in a VersionNotFoundException exception being thrown.

private void VersionNotFoundExceptionDemo ( ) {
   // create a DataTable with one column.
   DataTable myTable = new DataTable ( "myTable" );
   DataColumn myColumn = new DataColumn ( "col1" );
   myTable.Columns.Add ( myColumn );
   DataRow newRow;
   for ( int i = 0;i <10; i++ ) {
      newRow = myTable.NewRow ( );
      newRow [ "col1" ] = i;
      myTable.Rows.Add ( newRow );
  }
   myTable.AcceptChanges ( );
   try {
      Response.Write ( "trying" );
      DataRow removedRow = myTable.Rows [ 9 ];
      removedRow.Delete ( );
      removedRow.AcceptChanges ( );
      // try to get the Current row version.
      Response.Write ( removedRow [ 0,DataRowVersion.Current ] );
  }
   catch ( System.Data.VersionNotFoundException rowException ) {
      Response.Write ( "VersionNotFoundException" );
      Response.Write ( rowException.Message );
   }
}
  C# VB

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