none
very strange behavior of the method GetChanges(...) from the DataSet class RRS feed

  • Question

  •  

    Hello !

     

    i'm using a typed DataSet called myDs. This dataset has 2 Tables, Table1 and Table2.

    i have created a DataSet like this:

     

    myDs dsOld = new myDs();

    //here i populate the 2 tables

    ......

    //and then call the method to get the added rows

    myDs dsNew = (myDs)dsOld.GetChanges(DataRowState.Added);

     

    at this point on dsNew i have only the added rows of Table1 instead Table2 is set to null.So, the method returns only the rows of 1 table (Table1).

    i have debugged the code and i see that the both tables of the dataset dsOld are full of rows that have the rowstate = added.

    somebody can explain me whats the problem ? it's seem like a bug

     

    E.

     

    Wednesday, October 24, 2007 8:04 PM

All replies

  • The usual thing that people "notice" with GetChanges is that it automatically includes related rows to satisfy foreign keys even if those rows have not changed.

     

    However, you seem to be describing something else.

     

    You could try to write some sample code that manually populates the two tables (using NewRow and DataTable.Rows.Add) and see if you can reproduce the problem (with full code that you can post here).

    Thursday, October 25, 2007 1:35 AM
  • i really dont understand. On my project it's still not working but i have created another project and on this one the method is doing its job.

    Now the question is, in which case i get a second table set to null when i call GetChanges ?

    Saturday, October 27, 2007 3:08 PM