Search code examples
c#sql-serverdatabasemicrosoft-sync-framework

Incompatible Database Versions when syncing


I'm trying to sync two CE databases as some spike work. I'm following the tutorial here - https://msdn.microsoft.com/en-us/library/ff928606(v=sql.110).aspx to do so.

When I try to synchronize the two databases I get the following error:

Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = C:\Projects\DataBase Spike\DataBase Spike\Local.sdf ]

This is my code

SqlCeConnection clientConn = new SqlCeConnection(@"DataSource='Local.sdf'");
SqlCeConnection serverConn = new SqlCeConnection(@"DataSource='Server.sdf'");

SyncOrchestrator syncOrchestrator = new SyncOrchestrator();

syncOrchestrator.LocalProvider = new SqlCeSyncProvider("ProductsScope", clientConn);
syncOrchestrator.RemoteProvider = new SqlCeSyncProvider("ProductsScope", serverConn);

syncOrchestrator.Direction = SyncDirectionOrder.UploadAndDownload;

syncOrchestrator.Synchronize();

From this question here - SQL Server CE Incompatible Database Version I've ensured that my System.Data.SqlServerCe.dll is version 4.0, and I'm using SqlCeConnection


Solution

  • SQL CE 4 is not supported in Sync Fx. But you can get away with some assembly binding redirect... check out this post