[Mono-list] Error on SqlCommandBuilder

Carlos Guzmán Álvarez carlosga@telefonica.net
Thu, 26 Dec 2002 11:24:41 +0100


Hello:


> Could you please provide references within the .NET Framework documentation, as well as a test case that will validate your statement in .NET?  I would suspect that a deleted row could have a current value,
> as long as the deletion hasn't been committed yet.  If it has been committed, then it will be skipped when going through the process anyway.


A link to the Microsoft .Net Framework Documentation:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataversionnotfoundexceptionclasstopic.asp


I reproduce here the text and the sample:


The following example creates 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.


Sample:


private void DemonstrateVersionNotFoundException(){
     // 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{
        Console.WriteLine("trying");
        DataRow removedRow = myTable.Rows[9];
        removedRow.Delete();
        removedRow.AcceptChanges();
        // Try to get the Current row version.
        Console.WriteLine(removedRow[0,DataRowVersion.Current]);

     }
        catch(System.Data.VersionNotFoundException rowException){
        Console.WriteLine("VersionNotFoundException");
        Console.WriteLine(rowException.Message);
     }
  }







-- 
Best Regards

Carlos Guzmán Álvarez
Vigo-Spain

"No tengo dones especiales.Sólo soy apasionadamente curioso"
Albert Einstein, científico.