locked
How to best empty table on SQLCE when used with Sync Framework RRS feed

  • Question

  • Firstly, sorry for the rubbish title.

    I am creating an application for customer who has a number of engineers, with vans, carrying spares. We are using Windows Mobile 6.5 and Sync Services to sync thru WCF and all this works reasonably well.

    What I want to offer is the facility that the devices can be swapped from engineer to engineer and all he has to do is enter his 'location' or effectively choose his van from a list and his data will be fed down from the server.

    My concern about what might happen is that if I were to just delete the records from the local SQL Server CE database, that delete would occur at the server at the next sync. What I really want to do is when the location changes, it dumps the current stock information and just gets new information for the newly selected location, without trashing a heap of server details as this would be a nightmare.

    thanks in advance

    SYM

    Tuesday, June 8, 2010 10:38 AM

Answers

  • Hello -

    You pretty much prefer to delete some information/rows on the local SQL CE store (due to some business logic change) with being sent to the server.  The hight level guideline is that

    1. If you have prefer deleting some rows locally, please record them so that you can identify them in a later stage.

    1.1 Hook up the event ChangesSelected to the SqlCeClientSyncProvider.

    2. Do the normal bi-directional or upload sync.  These locally deleted changes will also be part of the enumeration in the dataset.

    3. Once changes is completed in enumeration, the ChangesSelected event is fired upon SqlCeClientSyncProvider.  At this moment, please exam all data rows in each data table of the enumerated dataset (which can be got as a property of the event argument) and find out if any rows are deleted "on purpose" when compared to step #1.  If it is, then remove it from the corresponding data table from the dataset.  In this case, the data set applied on the server will not contain the rows which you do not like server to delete.

    Thanks.


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, June 8, 2010 9:41 PM
    Answerer