locked
What would change the value of DateTime field when synchronizing with WCF? RRS feed

  • Question

  • Hi,

    Not sure if this issue is related to synchronization, or possibly WCF (or my code!), but thought I'd start here to see if someone can point me in the right direction.

    Synchronizing between a Sqlce client on WindowsCe and desktop server via WCF hosted in a Windows service application. I want to preserve the DateTime value in a transaction generated on the client, but after synchronization the corresponding DateTIme field in the host table is always +2 hours from the DateTIme captured in the client .sdf.

    The trace file shows this in the ApplyChanges message;
    <xs:element name="DateTimeStamp" type="xs:dateTime" minOccurs="0"></xs:element>
    <DateTimeStamp>2009-05-07T12:36:56-08:00</DateTimeStamp>
    NOTE: 12:36:56 is the time recorded in the client table.

    While the ApplyChangesResponse trace has this;
    <xs:element name="DateTimeStamp" type="xs:dateTime" minOccurs="0"></xs:element>
    <DateTimeStamp>2009-05-07T14:36:56-06:00</DateTimeStamp>

    The correct UTC offset is -6. I don't know where the -8 is coming from in the ApplyChanges messages.

    Any help will be appreciated. Thanks

     

    • Edited by cbp Thursday, May 7, 2009 7:34 PM
    • Moved by Hengzhe Li Friday, April 22, 2011 3:18 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Thursday, May 7, 2009 6:50 PM

Answers

  • Results of further testing;

    Looks like this may not necessarily be related to sync or WCF, but a code problem in a utility that sets the timezone on the windows ce device. I'll test some more, and if that's the case will return and mark this as answered.

    Thanks

    P.S. I'm still curious as to why the the timezone is included in the field and why it gets used to change the value on the host table rather than just passing through the dateTime as is...
    • Marked as answer by cbp Monday, May 11, 2009 1:34 PM
    Friday, May 8, 2009 7:28 PM

All replies

  • Hi,

    Didn't you consider using Timestamp data type instead of datetime?

    Regards,,,
    José Miguel Torres
    Friday, May 8, 2009 10:06 AM
  • Hi,

    The tables were designed prior to considering using sync services or WCF. The data type could be changed, but the idea is to capture the date/time a transaction occurred, and my understanding was that a timestamp data type was more appropriate as a unique identifier for a row rather than for capturing a clock based time.

    THanks
    • Marked as answer by cbp Monday, May 11, 2009 1:34 PM
    • Unmarked as answer by cbp Monday, May 11, 2009 1:34 PM
    Friday, May 8, 2009 1:39 PM
  • Results of further testing;

    Looks like this may not necessarily be related to sync or WCF, but a code problem in a utility that sets the timezone on the windows ce device. I'll test some more, and if that's the case will return and mark this as answered.

    Thanks

    P.S. I'm still curious as to why the the timezone is included in the field and why it gets used to change the value on the host table rather than just passing through the dateTime as is...
    • Marked as answer by cbp Monday, May 11, 2009 1:34 PM
    Friday, May 8, 2009 7:28 PM
  • Ok, keep us up to date.

    Regards,,
    José Miguel Torres
    Monday, May 11, 2009 10:55 AM