Sample – SQL Express Client Synchronization using Sync Services for ADO.NET

We have just posted a new sync sample to our Code Gallery that demonstrates how to enable offline data collection applications to synchronize a SQL Express client database to another SQL Server database using the Synchronization Services for ADO.NET library.  In this scenario, SQL Express client databases can be used as client databases to a central ADO.NET enabled database.  Unlike the existing peer-to-peer synchronization SQL Express provider sample which you may have seen, this sample is optimized for a hub-and-spoke topology.

In this sample, two tables (orders and order_details) are on the server database and also on the local client database.  The sample synchronizes edits to these table to keep their data identical.
This sample demonstrates:

  • Using SQL Express to cache changes for a client application.

  • A customized SQLExpressClientSyncProvider class that wraps around Microsoft.Synchronization.Data.Server.DbServerSyncProvider.

I would like to point out that even though we have done a fair amount of testing in house with this sample, it is still only posted as a sample.  In the future we certainly plan of including a fully supported version of a SQL Express client provider within a future release of Sync Services for ADO.NET. 

With that, we certainly want to hear your feedback on this sample and please feel free to post comments to our Sync Services for ADO.NET forum.

Liam Cavanagh

Comments (13)

  1. We have released a new sample on our Sync code gallery site that demonstrates use of Sql Express database

  2. We have released a new sample on our Sync code gallery site that demonstrates use of Sql Express database

  3. Microsoft has released Sync Framework couple months ago, enable offline data collection applications…

  4. Пример еще одного из сценариев реализации синхронизации и offline-enabled прилож

  5. Acaban de anunciar, en el blog del equipo de desarrollo de MS Sync Framework , un ejemplo (en CodePlex

  6. rgmust95 says:

    I am in the process of making an engine that will sync between sql 2008 server and sql 2008 express.

    The sample has worked great … but when i do "download only" it doesn’t apply the changes.

    It recognizes what to change.. it just doesn’t apply them.

    Any ideas??



  7. rajeshatexcelencia says:


    We are using SQL Express provider for sync to develop an application to sync between SQL Server 2005(server) and SQL Express 2005(client).

    The scenario is as below:

    1. We synchronize data from server to client (which loads a fresh set of data successfuly on client)

    2. Now we change some rows on the client DB (updates) on the rows which were synchronized from the server DB.

    3. Now when we try to synchronize the changes from the client Db to Server back, it gives us a primary key violation error as below:

    Error Message:

    Conflict detected while applying changes to the server.

    Table: Orders.

    Conflict Type: ClientInsertServerInsert.

    Error: Violation of PRIMARY KEY Constraint ‘PK_orders_7c848OAE’. Cannot insert duplicate key in key in object ‘dbo.orders’.

    The statement has been terminated.


    The server row will not be updated.

    Could anyone please tell us what could be wrong in this sql express adotpion, the same works when we use a SQL Ce on the client.

    The original sample which we took from the link below also has this same issue:

    Pls any help would be greatly appreciated

  8. bdrajer says:

    Hi guys,

    We’ve been tinkering with the SQL Express Client Sync Provider, added support for DateTime anchors and possibly fixed a bug which mixes up client and server anchors. You may be interested to take a look at this:

  9. Nitin says:


    I want to sync SQL server 2008 and Express 2008 DB. I see your Example it’s too good very use full. I am having 20 to 25 tables in my DB. And as per your solutions, we have to write 8 Stored Procedure and trigger for each table. Plus we have to also write down lots of code for calling this SP and passing parameters to SP (as I am having more than 50 columns in each table) for synchronization.

    Will you please help me, any simple solution or how I can avoid writing lots of code, Stored Procedure and triggers?

    Looking towards your kind positive reply

    Thanks and Regards,


  10. Kalpana says:

    Hi Nitin

    Did you receive any updates for your question?


  11. Sync Services for ADO.NET Download only says:

    How can Download only SQL database using Sync Services for ADO.NET?



    Rui Mig

  12. Devgig says:

    The ability to do this is very important to our software company.  It is required by the industry we support.

  13. Brent says:

    Looks like MS has left Sync to die, which is very unfortunate and a huge pain for developers like myself. I wrote a feature rich sync app for hub-spoke Sql Server that can use either Sync 2.1 Sync Orchestrator or SqlExpressClientSynchronization with SqlChangeTracking. Using the examples on…/debugging-sql-express-client-sync-provider however I can't get any SyncDirection besides BiDirectional working with Sql Change Tracking.

Skip to main content