New Code Sample: Database Sync – SQL Server and SQL Server Express

With the recent release of Sync Framework 2.0, we have added the ability to target SQL Express on the client.  For many developers, there are a handful of features such as stored procedures, XML support, and advanced profiling capabilities that are must-haves. For certain scenarios, these needs outweigh some of the benefits provided by SQL Compact, such as friction-free deployment and an extremely lightweight footprint.  This sample demonstrates how you go about leveraging SqlSyncProvider for both the client-side database and the server. Also note that the sample leverages WCF as the transport layer, although a 2-tier architecture is fully supported as well.  Special thanks to Dong Cao for writing this sample.  Dong is one of our test leads and has been working in the sync space since the WinFS days.  Enjoy!


The sample can be found here:


Sean Kelley

Comments (3)

  1. says:

    We are currently using a Dynamics AX partner product called FSA from Hitachi Consulting.  The software requires the database to be sync’d from the main server to each laptop.  The 700+ laptops are feild service technicians that have wireless mobile cards.  Our problem is that syncing the database (currently around 100mb) in size gets difficult.  Currently Hitachi has a custom way of syncing the data by sending all the keys to the server, doing a compare, and then sending updated rows back to the laptop.

    Now my question is, does the Sync framework support such a distributed without overwhelming the server of sending massive amounts of data to the client?



  2. yoyo says:

    How can I create multiple filters for userA/B/C…?

    Here is my code:

    string scopeName == "UserA";// or userB, etc. It will be changed.

    DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(scopeName);

    SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning();

    if (!serverConfig.ScopeExists(scopeName, connServer))


    scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("Table", connServer));




    serverConfig.Tables["Table"].FilterClause = "[side].[name] = '" + scopeName + "'";



    At the first time it always works well. But if I change the scopeName's value, there will be a exception "…_tracking tables already exist".

Skip to main content