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

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

  • 2012年2月15日 上午 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?

    • 已移動 ErikEJMVP 2012年2月17日 上午 08:24 (From:SQL Server Compact)
    •  

所有回覆

  • 2012年2月16日 上午 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

  • 2012年2月17日 上午 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.


  • 2012年2月17日 上午 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

  • 2012年2月17日 上午 08:30
    版主
     
     已答覆

    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

    • 已提議為解答 ErikEJMVP 2012年2月17日 上午 08:38
    • 已標示為解答 Honey25 2012年2月23日 上午 06:22
    •  
  • 2012年2月18日 上午 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??

  • 2012年2月18日 上午 07:08
    版主
     
     
    if you refer back to the matrix, Sync Framework 1.0 SP1 requires SQL Server Compact 3.5 SP2
  • 2012年2月18日 上午 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?


  • 2012年2月19日 上午 12:30
    版主
     
     

    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

  • 2012年2月23日 上午 06:22
     
     

    Thank you June T

    its working fine.