Getting changes from the database

  • Thread starter Thread starter Limberger Florian
  • Start date Start date
L

Limberger Florian

I'm using a DataAdapter to Update and Synchronize with the database.
When I do a Fill on my dataAdapter I get the changed and new records from
the database (changed by other users) into my dataset but not those which
have been deleted at the database.

Is this the way the DataAdapter should work (don't synchronize the deleted
records from the database to the dataset) or is it my fault?

If this is the way the DataAdapter act's what can be done, do get completely
in synch? If I do a clear on my dataset before invoking the Fill method, my
databinding get's lost for a Moment, because the dataset is completely
rebuild.

Thanks.
 
Limberger Florian said:
I'm using a DataAdapter to Update and Synchronize with the database.
When I do a Fill on my dataAdapter I get the changed and new records from
the database (changed by other users) into my dataset but not those which
have been deleted at the database.

Is this the way the DataAdapter should work (don't synchronize the deleted
records from the database to the dataset) or is it my fault?

How can retrieve non-existing (deleted) records - deleted rows are, well,
deleted?
If this is the way the DataAdapter act's what can be done, do get completely
in synch? If I do a clear on my dataset before invoking the Fill method, my
databinding get's lost for a Moment, because the dataset is completely
rebuild.

Yes. You might invoke BindingManagerBase.SuspendBinding() method.
However after ResumeBinding the position will be reset.
 
How can retrieve non-existing (deleted) records - deleted rows are, well,
deleted?

I meant, that the dataAdapter could delete the row within the
dataset if there is no corresponding one in the database. Just by comparing
the new retrieved dataset with the old one.
But that might be more overhead, than doing a clear and rebuilding.
Yes. You might invoke BindingManagerBase.SuspendBinding() method.
However after ResumeBinding the position will be reset.

Well, I could save the old ID and restore the Position (via searching in the
dataset).

thanx
Flo
 
Hi,

Limberger Florian said:
I meant, that the dataAdapter could delete the row within the
dataset if there is no corresponding one in the database. Just by comparing
the new retrieved dataset with the old one.
But that might be more overhead, than doing a clear and rebuilding.

Then you should do the following:
Load new data into new dataset.
Compare original and new dataset for deleted rows (those that are present in
original but not in new one).
Delete the deleted rows in original dataset.
Perform an original.Merge(newone).
That should do the trick.

Well, I could save the old ID and restore the Position (via searching in the
dataset).

Sure.
 
Back
Top