views:

19

answers:

1

I'm having some problems with a Windows Mobile 5.0 client application running under the .NET compact framework synchronising data with a asp.net 2.0 web service.

Here's a list of the steps that are performed, followed by where I think the problems are occurring:

  1. Client collects local data from its SQL Compact Edition database that does not have a server-side primary key yet.
  2. Client calls a web service passing up the 'new' data plus a list of other data already stored on the device that already have primary keys (so the web service knows what is already there!).
  3. The server inserts the new data in our central database, which in turn grants the record a unique server-side primary key.
  4. The response of the web service call is now loaded up with (1) new data that has been added centrally on the server since they synch-ed up last, (2) data that has changed since the last synch so that we can update data already on the device and the (3) newly-assigned server-side primary keys for the data that was just uploaded.
  5. The client stores the new data from the server (1), updates the changed data (2) and records the server-side primary keys for the data that was just uploaded (3).

I hope the above makes sense!

I've found that I am getting some duplicated data on the device and this is due to the network connection failing during the download of the response to the client. The reason for this is that the server is inserting the new data but the data telling the client what its server side primary key is, is not getting back to the client. This leads the client to try to upload the new data the next time it syncs, despite it already being inserted in our central database.

I just can't think of a way that my central server can determine if the client received the response properly, can anyone suggest any better ways to make this whole thing more transactional?

A: 

The server inserts the data then returns teh keys to the client. The client then updates its key set. Why don't you add a final method call from the client to tell the server it has successfully updated its key, which would tell the server to commit the transaction?

ctacke