Are there any Synchronization APIs to detect if the Client database is modified . RRS feed

  • Question


    I want to call Synchronization based on a condition. The Condition is " If there is a data change in the Client database (SQL SERVER CE) then I want to call the Synchronization. I dont want to call this from a button click event or Form onload. I want to know if there are any ADO.NET Synchronization APIs available that can be used to leverage my requirement. If not available please any one let me know if I can handle this requirement in any way.


    For example. I have a method where I am writing the code that takes care of Synchronization. If I call this method in a button click event, or form load  it works fine. But I want to call this method only when there is a data change in the local client database.






    • Moved by Max Wang_1983 Friday, April 22, 2011 10:01 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, September 12, 2007 12:37 PM

All replies

  • Hi.

    I am not sure but you can try SqlCeClientSyncProvider's event. There are quite few events in client provider may be one of them is useful to you. Just giving you sample code.

     SqlCeClientSyncProvider clientSyncProvider = new SqlCeClientSyncProvider(strClientConnectionString);
     syncAgent.LocalProvider = clientSyncProvider;


    Try this may work for you...

    Thanks & Regards,
    Meet Vijay Shah
    Friday, September 14, 2007 10:19 AM
  • Hi,


    Check out the other methods on the SqlCeClientSyncProvider. You will find a method called GetChanges(), this method should return a dataset of pending changes that needs to be uploaded (inside the SyncContext object), if the dataset is empty then nothing is pending.



    Friday, September 14, 2007 3:42 PM
  • Hi,


    Is there anyway that sync service will notify the client that there is an update in the server database. In response to this notification, client shall start the synchronization module.


    One option could be.

    Server shall have the built in triggers in its database. and when any changes occurs to the database,  server will notify the client (Server should know the client handle in this case.).


    However I am not sure about the feasibility of this approach Smile



    Smitha Rao


    Friday, September 21, 2007 5:58 AM



    Thanks for the reply. One more question.


    I am using ADO.NET Synchronization Services to develop an application . How do I track the changes in the Server Database before synchronization. I mean, if there is any change in the Server Database then only I want to Synchronize the data from the server to the Client Database.


    Thanks and Regards.

    Tuesday, October 9, 2007 12:41 PM

  • Hi.
    You might required to use Bidirectional Synchronization. and in serverprovider you might get some event which can track server changes.

    Thanks & Regards,
    Meet Vijay Shah
    Friday, October 12, 2007 1:15 PM
  • since most of the time, the client could be disconnected from the server, so the server can send notification to the client, it may not be reached to the client unless there was some logic built into the server side application to detect the client.


    also, since sync is invoked at the client side, so you might avoid to use the server provider to do the trick here. better idea is to either use trigger on the sql server or some other similar ways to detect servet changes, then raise up the notification to the client, while, on the client there is some logic to detect sucn notifcation, and then invoke the sync process.


    hope this helps.




    Friday, October 12, 2007 8:26 PM