How can i Synchronize .sdf Database to .mdf Database and viceversa RRS feed

  • Question

  • Hi

    I have a project running in tablet device it has Sdf file as its data base and we created a server database for accessing in every device(pcs) Now how should i synchronize the Sdf file data and Database in the server. Please guide me any idea?

    • Moved by ErikEJMVP Friday, February 17, 2012 8:24 AM (From:SQL Server Compact)
    Wednesday, February 15, 2012 6:56 AM


All replies

  • Provided you are using version 3.5 of SQL Server Compact - you can use Merge Replication (requires SQL Server Standard or better) or Sync Framework. Or you can roll your own web services.

    Please mark as answer, if this was it. Visit my SQL Server Compact blog

    Thursday, February 16, 2012 9:15 AM
  • Hi ErikEJ

    here is some code roughly coded to test the synchronization between sdf file and server file

    SynchronizationSyncAgent syncAgent = new SynchronizationSyncAgent();

    Microsoft.Synchronization.Data.SyncStatistics syncStats;

    provided paths of the databases.....

     syncAgent.LocalProvider = syncProviderClient;
     syncAgent.RemoteProvider = syncProviderServer;

     syncAgent.clientDB.SyncDirection = Microsoft.Synchronization.Data.SyncDirection.Bidirectional;

    and given remaining tables..

    syncStats = syncAgent.Synchronize();----- Exception MissingMethodCaught Exception

    I m getting and error in the above line as

    Method not found: 'Boolean System.Data.SqlServerCe.SqlCeChangeTracking.UpgradePublicTracking(System.String)'.

    Can u please help me out how to clear this exception.

    Friday, February 17, 2012 6:39 AM
  • Hi, Am moving to the sync forum to get an answer.

    Please mark as answer, if this was it. Visit my SQL Server Compact blog

    Friday, February 17, 2012 8:23 AM
  • are you running SQL CE 3.5 SP2?

    check that you have the matching SQL CE and Sync Framework versions.

    see: http://social.technet.microsoft.com/wiki/contents/articles/clarifying-sync-framework-and-sql-server-compact-compatibility.aspx

    • Proposed as answer by ErikEJMVP Friday, February 17, 2012 8:38 AM
    • Marked as answer by Honey25 Thursday, February 23, 2012 6:22 AM
    Friday, February 17, 2012 8:30 AM
  • Hi June T

    i think your right..

    I m using

    1. Sync Framework 1.0 SP1

    2. SQL Server Compact 3.5 SP1

    3. Visual Studio 2010

    let me know if SQL Server Compact 3.5 SP2 is upgraded, will the exception will be cleared and sync data??

    Saturday, February 18, 2012 6:04 AM
  • if you refer back to the matrix, Sync Framework 1.0 SP1 requires SQL Server Compact 3.5 SP2
    Saturday, February 18, 2012 7:08 AM
  • Hi June T

    Thank you for your quick response.

    I refered, Yes as you said it needs SQL Server Compact 3.5 SP2,

    my question is whether the above code is correct or not for synchornization?

    Saturday, February 18, 2012 9:08 AM
  • if you have set your adapters correctly, that looks fine. if you've used the Local Database Cache wizard, then it looks fine as well.

    have a look at this tutorial:  Walkthrough: Creating an Occasionally Connected Application

    Sunday, February 19, 2012 12:30 AM
  • Thank you June T

    its working fine.

    Thursday, February 23, 2012 6:22 AM