Different date and time on local and remote server RRS feed

  • Question

  • Hi all,

    I use sync Fx to synchronize SQL Server Express 2012 and SQL CE 3.5. Data are exported from SQL Server db to SQL CE, then on mobile device are created and modified and in the end they are downloaded from device to "big" database.

    My problem is that sync_update_peer_timestamp is earlier than on SQL Server Express after data modification on mobile device. Can it be caused only by different date/time and timezone? Or are there any other reasons for that?

    How can I solve that problem during synchronization? Can I force sync FX to update that row in SQL Server? Do you know any solution to prevent such situations?

    Logged info in app:

    LocalInsertRemoteInsert ApplyingInserts
    SalesId: DIMA2607 | ... | sync_update_peer_timestamp: 991772 | sync_update_peer_key: 0 | sync_create_peer_timestamp: 987639 | sync_create_peer_key: 0 | 

    SQL CE (recently modified):
    SalesId: DIMA2607 | ... | sync_update_peer_timestamp: 973259 | sync_update_peer_key: 1 | sync_create_peer_timestamp: 969127 | sync_create_peer_key: 1 | 


    Saturday, July 27, 2013 3:14 PM

All replies

  • Hi again,

    I'm wondering what data type I should use to convert those timestamps to compare them.

    What are those value at all? They are Int64 for sure. How they are calculated? What is "zero" date-time? Can anybody answer me those questions, I would be grateful. Then I would try to investigate it. The problem is that I don't have access to that device and whole the environement but I have to figure it out based on log that I attached part of it above.


    Monday, July 29, 2013 10:06 AM
  • Ok , I found this:

    "SQL Server's TIMESTAMP datatype has nothing to do with a date and time!"

    But still I need to know how it's generated and why in my case the timestamps values of modified records on device are less than those erlier from SQL Server. 

    Monday, July 29, 2013 11:12 AM
  • the timestamp values are not generated by Sync Fx. timestamp values are automatically generated when a column type is specified as timestamp. timestamps are not universal values. each database will have its own "series" of timestamps.

    what's the actual issue you're having with the timestamps? is it preventing you from synching?

    can you clarify how you're initializing your client database? specifically this "Data are exported from SQL Server db to SQL CE"

    Tuesday, July 30, 2013 1:16 AM
  • Thanks for response JuneT.

    Synchronization process:

    1. Provision creation for download (table is skipped if provision exists)
    2. Data downloading from SQL CE to SQL Server
    3. SQL CE db backup
    4. SQL CE db deletion
    5. New SQL CE db creation
    6. Synchronization: SQL Server -> SQL CE 

    I recreate SQL CE db because I export ranges of data for some tables (table filtering). Some records used once on device are never exported to device again.

    But timestamps are related to date and time because once I had wrong timezone set on device and timestamp of updated record on device was earlier (I had the same sync error). Now my client states that date, time and time zone is synchronized with SQL Server and "big" app, but the issue occured again. I'm wondering whether some other things can affect timestamp on device.

    The questions are:

    1. Can I force SyncFX to synchronize those records?
    2. How to avoid this kind of situation? (date, time and timezone, anything else?)


    Tuesday, July 30, 2013 8:27 AM
  • the timestamp data type in sql server or sql ce has nothing to do with date and time. you can look it up if you want.

    if records are not exported on first sync to a newly created database, i suggest you look at your filtering.

    Tuesday, July 30, 2013 11:16 AM
  • Finally I forced to apply changes by using:

    e.Action = ApplyAction.RetryWithForceWrite;

    in ApplyChangeFailed event. But problem still not solved.

    Sunday, November 24, 2013 2:06 PM
  • do you see the records in the ChangesSelected event? do you see them having conflicts on ApplyChangeFailed event?
    Thursday, November 28, 2013 1:30 AM