TableAdapter Merge issue

U

usernameexists

I've a DataSet with lots of DataTableAdapters which all work fine, but
i'm getting a very strange behavior when merging two unchanged
DataSets:

pseudo code:

MyDataSet ds1 = new MyDataSet();
new MyTableAdapter().Fill(ds1.MyTable);

MyDataSet ds2 = new MyDataSet();
new MyTableAdapter().Fill(ds2.MyTable);

ds1.Merge(ds2, true, MissingSchemaAction.Error) // Need to preserve
changes because there might be some, but not in this test case.

The Select statement isn't anything special either: 'SELECT Column1,
Column2, ... FROM MyTable' and the Database entries are garanted to be
unchanges between queries.

Problem:
After merging those two MyDataSets all rows of MyTable are marked as
changed, but really aren't (i'm absolutly positive about that), so:
DataRowState.Unchanged * DataRowState.Unchanged = DataRowState.Modified

On the other hand modifying one row in ds1.MyTable before merging
results in one changed entry afterwards, which is correct...

I'm disecting this for hours now, but can't find a solution for it.
Funny that nobody else does seem to have such problems, all articles
and forum entries i've found releate to changes NOT reflected within
the DataTable, which works perfectly well in my case...

Does anyone have an idea or suggestions on how this problem came to be?

Thank's in advance!
 
E

Earl

When you merge one dataset (or datatable) into another, if the schema is not
identical for the Select statements, you will have "changes".
 
U

usernameexists

Thank you for your answer, but i'm using the same method for filling
both DataSets (.Fill(DataTable table)), they are practically the
same... The select statements equal and the number and content of rows
returnd equals to, since the database hasn't changed between those
queries, but still after a merge all rows are marked as modified.

Also i've noticed that there are RowChanging and RowChanged events
raised, but no ColumnChanging / ColumnChanged event, which would
suggest that there not really is a change of data... so your suggestion
goes in the right direction, but i've no idea how the schemas could
possibly differ.

Do you have any other idea? (i thought that maybe i'ts got to do with
RowVersion or something, but i'm not familiar with that.)
 
Top