Partilhar via


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

  • Anonymous
    June 24, 2008
    We have released a new sample on our Sync code gallery site that demonstrates use of Sql Express database

  • Anonymous
    June 24, 2008
    We have released a new sample on our Sync code gallery site that demonstrates use of Sql Express database

  • Anonymous
    June 24, 2008
    Microsoft has released Sync Framework couple months ago, enable offline data collection applications...

  • Anonymous
    June 24, 2008
    Пример еще одного из сценариев реализации синхронизации и offline-enabled прилож

  • Anonymous
    June 24, 2008
    Acaban de anunciar, en el blog del equipo de desarrollo de MS Sync Framework , un ejemplo (en CodePlex

  • Anonymous
    August 01, 2008
    The comment has been removed

  • Anonymous
    November 05, 2008
    Hi, We are using SQL Express provider for ado.net 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. Order_id:381. 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: http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=1200 Pls any help would be greatly appreciated
  • Anonymous
    May 04, 2009
    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: http://www.8bit.rs/blog/?p=23

  • Anonymous
    July 05, 2010
    Dear, 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, Nitin    

  • Anonymous
    January 13, 2011
    Hi Nitin Did you receive any updates for your question? Thanks

  • Anonymous
    January 30, 2012
    How can Download only SQL database using Sync Services for ADO.NET? Thanks Regards, Rui Mig

  • Anonymous
    December 31, 2012
    The ability to do this is very important to our software company.  It is required by the industry we support.

  • Anonymous
    February 18, 2014
    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 www.8bit.rs/.../debugging-sql-express-client-sync-provider however I can't get any SyncDirection besides BiDirectional working with Sql Change Tracking.