locked
Error handling in SyncServices RRS feed

  • Question

  •  

    Hi,

     

    I am using StoredProcedures in my Sync strategy, I wanted to rollback all the SP changes if any error occurs even in single procedure. I cant use SqlTransaction from frontend as I am not executing SPs using ADO.NET.

     

    Currenly, its just skipping inserting into that particular table and inserting into all other tables where ever it is not conflicting with PK-FK relations.

     

    Is there anyway to handle that using SyncServices??? Any help is appreciated.

     

    Thanks,

    Sreevi

     

    • Moved by Max Wang_1983 Friday, April 22, 2011 10:41 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, June 1, 2007 10:55 PM

Answers

  • Hi,

     

    The ServerSyncProvider fires ApplyChangeFailed event whenever it fails to apply a row. You should subscribe to that event and throw exception of your own to cancel the sync. The runtime is executing in a transaction so that if you throw, the transaction will be rolled back.

     

    Give it a try and let me know if you have any issues.

     

    Thanks

    Tuesday, June 5, 2007 2:44 PM