locked
Datetime problem? RRS feed

  • Question

  • Hi,

    I have a little problem with the sync framework and datetime.

    After a synchronize DateTime in my Sql Server Express 2005 have a difference from my mobile database... (not used to check synchronize).

    Sample:

    A data row in my mobile : 17/11/2008 00:00:00

    After Synchro --> same data row but in Sql Server Express : 17/11/2008 09:00:00


    Don't know how is it possible...

    When the Framework do the request to insert data, it add 9 hours to all datetime...

    No idea?

    thx you very much and sorry for my bad english.
    • Moved by Hengzhe Li Friday, April 22, 2011 5:25 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, November 17, 2008 8:45 AM

Answers

All replies

  • Hi SoBaKaaa

     

    Is the datetime in your devices the same?  Are they in the same timezone, same time?  

     

    Maria del Mar Alvarez Rohena - MSFT

     

    Tuesday, November 18, 2008 12:08 AM
  • Hi,

    Yes th
    ey are... All is correct... I have checked all "possible" problem about datetime... timezone, regional settings,....The unique solution have found is add a little code in the methods ApplyChanges in my service :

    Code Snippet

    foreach (DataTable dt in dataSet.Tables)
    {
    foreach (DataRow row in dt.Rows)
    {
    for (int i = 0; i < row.ItemArray.Length; i++)
    {
    DateTime? date = row[i] as DateTime?;

    if (date.HasValue)
    row[i] = date.Value.Subtract(new TimeSpan(9, 0, 0));
    }
    }
    }


    Now, all datetime are correct... But i don't understand why i have to do this and i think now, i'm crazy Wink
    Tuesday, November 18, 2008 8:56 AM
  • Hi again SoBaKaa

     

    I am investigating this problem, will get back to you within 48 hours.

     

    Maria del Mar Alvarez Rohena - MSFT

     

    Tuesday, November 18, 2008 5:48 PM
  • SoBaKaa

     

    You said both your device and computer have the same time, and time zone?  Can you verify if either your device or computer are using UTC time? 

     

     

    Maria del Mar Alvarez Rohena - MSFT

     

    • Proposed as answer by Mariano Pass Wednesday, March 4, 2009 7:03 PM
    Thursday, November 20, 2008 2:02 AM
  • Hi,

    The 'UTC Time' is used only for Anchor in Sql Server 2005 Express.
    Thursday, November 20, 2008 2:11 PM
  •  

    Can you check the dataTiem value sent to/from IIS Server to see if there are any changes at the transfer layer?

     

    Maria - MSFT

    Thursday, November 20, 2008 7:16 PM
  • hi, i'm having the same problem, with the diference that i'm using sql server 2008.
    Wednesday, March 4, 2009 7:05 PM
  • When synchronization happens between a SQL Server 2005 and SQL Mobile, I think IIS/Web Service should be involved.  Therefore the DataSet needs to be serialized and de-serializad.

    Please check the below 2 links and see if helps.

    http://support.microsoft.com/default.aspx/kb/842545
    http://social.microsoft.com/Forums/en-US/syncgeneral/thread/9858d657-ce26-442a-86a7-e2ba6b774ebf

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, March 5, 2009 7:32 AM
    Answerer
  • thanks, thats right, the problem is in the ws. in my case, the client was configured in another time zone by error.
    Friday, March 6, 2009 12:04 AM