Hi,
I'm writing a program that communicates with a database and a service
that contains a collection of jobs. The database is used as a copy of
the queue for interaction with legacy software. So the purpose of the
program is to synchronize the service's collection with a table on the
database.
The users will be inserting and updating rows in the table and they
will also be querying it for jobs' statuses, so the synchronization is
bidirectional.
I don't have any problems with receiving changes from the service and
updating them in the database.
The solution I'm working on for receiving the users's inserts and
updates to the table is as follows:
1. query the table (--> ds1)
2. after a set interval, query the table again. (--> ds2)
3. compare ds1 and ds2 for changes: new rows are to be inserted to the
service's collection and rows with changes will be updated in the
collection.
The primary key in both datasets is set.
Now the only problem left is to find out what's been changed. I tried
ds1.Merge(ds2) and then ds1.GetChanges() but it either returns the
whole ds1 (if I set preserveChanges = true) or null (preserveChanges =
false).
How do I make it return only the rows I need? (or is it not the right
way to do it?)
Thanks in advance,
Zzzbla
|