locked
How to delete from client after sync RRS feed

  • Question

  • Hi all

    I need to be able to delete all records from a number of my client sync tables after succesful synchronisation. I'm calling my code to clear the sdf tables after synchronisation which works fine (all data is deleted). However this is causing issues on the next sync (no data in client tables) as the dataset being passed in to the DbServerSyncProvider.ApplyChanges method still has 1 row with a RowState of deleted, resulting in a DeletedRowInaccessibleException.

    Does anyone have any ideas on this?
    • Moved by Hengzhe Li Friday, April 22, 2011 2:57 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, January 14, 2009 1:00 PM

Answers

  • Hi

    I managed to get around this by calling the AcceptChanges method of my SqlCeClientSyncProvider on my Client Sync Agent, passing in all the table names that had records deleted locally, which works well.

    I think there needs to be some provision in Sync Services to allow automatic deletion of client records after sync, it must be a common requirement to keep local sdf sizes down if data is not required on the client post sync.
    Wednesday, January 28, 2009 10:58 AM

All replies

  • Sounds like a bug to me. could you please provide more details with this case ? a repro would be much helpful.

     

    thanks

    Yunwen

    Thursday, January 15, 2009 6:34 PM
    Moderator
  • Hi

    I managed to get around this by calling the AcceptChanges method of my SqlCeClientSyncProvider on my Client Sync Agent, passing in all the table names that had records deleted locally, which works well.

    I think there needs to be some provision in Sync Services to allow automatic deletion of client records after sync, it must be a common requirement to keep local sdf sizes down if data is not required on the client post sync.
    Wednesday, January 28, 2009 10:58 AM
  • if some data is not needed on client, why not use filter to filter them out for the sync ? so they won't even downloaded to the client side from the server ?

     

    thanks

    Yunwen

     

    Thursday, January 29, 2009 9:31 PM
    Moderator
  • Imagine a sync filter on a table named TRADE (having a column TradeState - possible values are new, executed, settled)  where TradeState <> 'settled'. This will not sync trades that are already settled.
    But, all trades go through this lifecycle. So the trades when in 'new' state will get synced. They are in CE when state changes to executed and then settled. As they do not get deleted automatically because they do not satisfy the filter cause any more (of course, we need this without deleting the 'settled' records on remote provider - say SQL Server 2008), that means filter cause will not help in this case. Any ideas?

    Thursday, February 19, 2009 5:07 AM
  • I just wanted to chime in that I'm trying to solve the same problem of deleting records on the device's SDF once said records have been successfully synced to the main server. However, like the above poster stated, I do NOT want the "deletes" to sync up to the main server. I just want to keep the SDF on the device manageable, and like the above, once a trade is done, the device does not need to keep the db-records around just to soak up space.
    Thursday, March 19, 2009 6:35 PM
  • +1. I too am deleting records locally after sync for reasons stated above. It would be nice to have this option built into the sync framework rather than having to hand-roll it each time.
    Thursday, June 18, 2009 10:33 AM