locked
Advise on Concurrency issue of Sync'ing of Remote DB and SQL Express DB RRS feed

  • Question

  • Hey guys

    Need some advice:

    I followed the tutorial on Sync'zing SQL Server and SQl Express at this link:

    http://msdn.microsoft.com/en-us/library/ff928700(v=SQL.110).aspx

    And I can report the test application regarding the above works great and very impressive (thanks of course to June T for helping out).

    Now I have a second test application base on above tutorial, I have two databases : Remote DB (called SyncDB) and my SQLExpress DB (called SyncExpressDB). Lets call my test application: MySyncAppi.

    MySyncAppi is connected to SyncExpressDB via a dataSet/dataAdapter method - so in MySyncAppi I have some fields that I complete eg Name and ListPrice where input some data and use an Update Method that updates the changes to SyncExpressDB. Then using the techology/methods described in the above MSDN link i "Execute Sync" and my changes in SqlExpressDB are persisted into my main Remote DB namely SyncDB.

    Just to be clear all this works great and very cool and sync's my DB's perfectly, even if I do i manual Update (SQL Update method) in either SyncDB or SQLExpressDB and "Execute Sync" method in MySyncAppi the changes are updated and reflect in both DB's and MySyncAppi's dataset.  

    The advise I need is the following:

    SyncDB is my main Database so basically whats in there should be Sync'ed down to SQLEXpressDB - but I need to work in a Disconnected environment - my laptop is for example unplugged for a week. I have saved some data to my local SQLExpressDB during the week, next week monday I plug back into the internet and want Sync my chanes back to my Remote DB.

    The problem:

    in SQLExpressDB i have  : ID/primarykey= "3" ; Name="Laptop" ; ListPrice ="500.00"

    in SyncDB i ALSO have   : ID/primarykey= "3" ; Name="Laptop" ; ListPrice ="500.00" ( this is becuase another admin guy has updated the SyncDB

                                                                                                                                   and made these changes  a few days before me. )

    As you can see I now have a dilemma - either an error will be chucked or one of the records in one of the DB's are going to get overwritten. It all cases this is a problem as you can imagine.

    What would be the best practise or solution to detect such concurrency issues and/or resolve them with Microsoft Sync Framework Technology?

    Kind regards

    Geo

    Thursday, November 17, 2011 12:20 PM

Answers

All replies