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

Answered How can i Synchronize .sdf Database to .mdf Database and viceversa

  • mercredi 15 février 2012 06:56
     
     

    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?

    • Déplacé ErikEJMVP vendredi 17 février 2012 08:24 (From:SQL Server Compact)
    •  

Toutes les réponses

  • jeudi 16 février 2012 09:15
     
     
    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

  • vendredi 17 février 2012 06:39
     
     

    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.


  • vendredi 17 février 2012 08:23
     
     
    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

  • vendredi 17 février 2012 08:30
    Modérateur
     
     Traitée

    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

    • Proposé comme réponse ErikEJMVP vendredi 17 février 2012 08:38
    • Marqué comme réponse Honey25 jeudi 23 février 2012 06:22
    •  
  • samedi 18 février 2012 06:04
     
     

    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??

  • samedi 18 février 2012 07:08
    Modérateur
     
     
    if you refer back to the matrix, Sync Framework 1.0 SP1 requires SQL Server Compact 3.5 SP2
  • samedi 18 février 2012 09:08
     
     

    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?


  • dimanche 19 février 2012 00:30
    Modérateur
     
     

    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

  • jeudi 23 février 2012 06:22
     
     

    Thank you June T

    its working fine.