Sync Services for ADO.NET won't sync if I move the database. RRS feed

  • Question

  • We have an application that uses Sync Services 1.0 for ADO.NET 2.  The client is SQL Server Compact Edition 3.5 SP1 and the server is SQL Server Express 2005.

    We download a number of code tables from the server and want to upload a number of user data tables.  These will be one way only transfers every day.  The basic code works as expected.  However I have sun into some isues.  We decided to enter some historical data into each users client database here at head office.  We did this using the application that will be used remotely.  For a brief time we had the upload table scommneted out and were only downloading.  When we re-added the upload tables, they would not sync as they were out of date with the daily sync process.  No problem, we just touched all the upload records and they were marked as updated and we could upload the data.

    Here is were it gets confusing.  If we run a sql script against the client db and then upload it works fine.  If we run that same update, then move the database to a different folder, the upload no longer works.  We are definitely connecting and trying to sync from the correct database.  We just moved the db's to a folder to run a script to touch the records in each individual client database then copied them back to their expected application folder.  The files that are updated, in place, in the applcation folder can be uploaded by the sync command to the server DB.  Those that are edited elsewhere and then copied to the application folder will no longer upload.

    Can anyone tell me if sync services is tracking the actual folder name that contains the db file in order to determine if new or edited records exist?  I found this article that seems to point to a similar problem and I can see from querying the ‘__sysSyncSubscriptions’ and the ‘__sysSyncArticles’ tables that the clientID and machineID change from one machine to another.  I cannot edit them as they are system tables.  Can client DB's be moved from one machine to another?  What if someones machine crashes and they want to copy a backup database to their new machine?  Will machine and client ID's or other factors cause the syncing to quit working?

    Thursday, January 28, 2010 9:59 PM


  • I don't think I could repro this issue.  This what I have tried.

    1. Doing sync with Server on Folder1.
    2. Copy the client .sdf file to a different folder and INSERT a new row.  Copy this .sdf file back to the original sync folder and do sync.  INSERT happens on the server.
    3. Copy the client .sdf file to a different machine and INSERT a new row.  Copy this .sdf file back to the original sync folder and do sync.  INSERT happens on the server.
    4. Keep the client .sdf file in place, delete a few rows.  Copy it to a different folder and do sync (sync app has already modify the client connection string so pointing to the new location).  Do sync and the deleted rows are shown on the server.

    One thing I would suggest to check is to subscribe the ChangesSelected event and check e.Context.DataSet.Tables where e is of class
    ChangesSelectedEventArgs.  See if any data rows were enumerated from the corresponding sync tables.

    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Sunday, January 31, 2010 11:30 PM