locked
ApplyingChanges - Custom handling of server deletes RRS feed

  • Question

  •  

    Hello,

     

    hopefully someone can shed some light on this.

     

    I have a sync scenario with SQL Server 2008 and several mobile clients with SQL CE 3.5.

     

    The problem I am currently running in is that I have the need to handle some deletes synced from the server manually (i.e. run a custom SQL command). I hooked up the ApplyingChanges event and also get the correct rows in the DataSet. But after I manually handled the delete I want to "remove" the change from the DataSet, so the SyncFramework does not try to run the delete again (which actually fails because of an extended primary key on the client).

     

    I tried both changedTablesIdea.Rows[j].Delete(), changedTablesIdea.Rows[j].RejectChanges() and changedTablesIdea.Rows[j].AcceptChanges(), none of them worked out for me. The problem is that the sync fails because of the above mentioned primary key constraint. On server side the row has a PK of lets say "id", but on the client this is extended to "id" plus "origin" (this is part of my custom trying to handle server IDs consistently).

    When the sync runtime tries to apply the delete it fails because there is no value for "origin", as deleted rows seem to not contain data. I also can't set it (would be a fixed value) because accessing the column in the DataSet for a deleted row also fails.

     

    I even tried to extend the primary key on the DataSet too, so I thought the delete command the sync runtime would execute would work, but it doesn't either.

     

    Does anybody have some hint for me? I simply want the sync to "forget" about that delete because I handle it myself.

     

    Regards,

    Andreas

    • Moved by Hengzhe Li Friday, April 22, 2011 6:37 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, January 7, 2009 9:34 AM

Answers

  • First of all I would say try to avoid schema difference between the sql server and the sqlce client db as much as you can.

     

    to this particular issue, you can resolve it by changing your selectIncrementalDelete query to:

    select Id as Id_orig <rest of the query text>

     

    in such case, the dataset would be constructed with "Id_orig" as the columname that matches your client column.

     

    thanks

    Yunwen

    Friday, January 9, 2009 3:27 AM
    Moderator