locked
Must Disable/reEnable SqlCeChangeTracking?! RRS feed

  • Question

  • I'm writing a custom sync client/server [yes, it's a HUGE undertaking, but Sync v1.0 just isn't happening for me with anchor-based batching which is all that is supported on a device] because this project has gone WAY long with all the problems with v1 and we've decided to walk away from it, but I still would like to use SQL's change tracking on the client and then upgrade the (currently 2k5) SQL Server to 2k8 to use the internal change tracking to send changes back down to the client..

    Anyway, I'm trying to see what changes are made on a device (SSCE35SP2) and I'm using code that checks ct.GetTrackingOptions(strTable,TrackingOptions.None) and it keeps saying I have to disable and reEnable change tracking, so I do that with ct.DisableTracking(strTable) and then ct.EnableTracking(strTable, TrackingKeyType.PrimaryKey, TrackingOptions.All)

    But I still get the same errors. I've tried deleting the SDF and performing a new full sync and then trying again because it was maybe because it was a non-SP2 SDF and I needed to reinitialize it? But still no love..

    Before I go any further with this, am I going to be able to get changes made at the column-level?  i.e.  I'm going to send XML to my server with the changed columns so they can get applied.. I don't want to send the whole row up in case it has got changed on the server-side

    Chuck.

    Wednesday, May 12, 2010 2:31 PM

Answers

  • Hi,

    It is a question for SQLCE actually. If your SQLCE database is created by SQLCE 3.5 SP1 and synced with 3.5 SP1 change tracking, you need to call SqlCeChangeTracking.DisableTracking and EnableTracking for your table to switch to SP2 change tracking model. If your SQLCE database is created by SqlCE 3.5 SP2, you need to call SqlCeChangeTracking.EnableTracking to enable CE change tracking for your table because it is not enabled by default.

    For column level change tracking, I don't think that the CE change tracking provides that level of granularity. After finding a row is changed based on CE change tracking, you need additional custom logic to figure out which column is changed if it is a must requirement for your scenario.

    Again, you may want to confirm these points in SQL CE forum.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, May 12, 2010 6:38 PM