locked
Local Database Cache - ChangeTracking Disable-Enable produces error on synchronize RRS feed

  • Question

  • using VS2008 SP1, SQL Server Compact 3.5 SP2, Sync Framework 2.1 SDK, Sync Framework Runtime V1.0 SP1

    1. I created a simple database (1 table with a Primary Key and 2 more columns) for testing.

    2. I created a Local Database Cache which uses ChangeTracking on server and client and enabled Bidirectional SyncDirection

    3. Then confirmed that all was working as expected.

    4. Then Disabled ChangeTracking on the client db:

        Private Sub btnDisableCT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisableCT.Click

            Try

                Dim cn As New SqlCeConnection(My.Settings.ClientTest263ConnectionString)

                cn.Open()

                Dim ssceCT As New SqlCeChangeTracking(cn)

                ssceCT.DisableTracking("Table_1")

                cn.Close()

                Debug.WriteLine("disabled sucessfully")

            Catch ex As Exception

                Debug.WriteLine(ex.Message)

                MessageBox.Show(ex.Message)

            End Try

        End Sub


    5. Then Enabled ChangeTracking on the client db:

     

        Private Sub btnEnableCT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnableCT.Click

            Try

                Dim cn As New SqlCeConnection(My.Settings.ClientTest263ConnectionString)

                cn.Open()

                Dim ssceCT As New SqlCeChangeTracking(cn)

                ssceCT.EnableTracking("Table_1", TrackingKeyType.PrimaryKey, TrackingOptions.All)

                cn.Close()

                Debug.WriteLine("enabled sucessfully")

            Catch ex As Exception

                Debug.WriteLine(ex.Message)

                MessageBox.Show(ex.Message)

            End Try

        End Sub


    6. for several tests I also confirmed that Tracking was actually disabled after #4 and Enabled after #5 using:
                Dim ssceCT As New SqlCeChangeTracking(cn)
                Dim ssceTO As SqlServerCe.TrackingOptions

                MessageBox.Show("Table_1 Tracking is " & ssceCT.GetTrackingOptions("Table_1", ssceTO).ToString)





    after step #5 the following error fires on the syncAgent.Synchronize() method

    "The specified change tracking operation is not supported. To carry out this operation on the table, disable the change 

    tracking on the table, and enable the change tracking."


    I have reproduced this error many (50+) times attempting to understand & circumvent it.
    I want to disable Tracking so that I can change the local database schema, change the appropriate data & sync objects and re-enable tracking using the new changes. 

    What's up with this error?

    Thursday, October 14, 2010 1:12 PM

Answers

  • can you try referencing the assembly from the 2.1 folder instead? (C:\Program Files (x86)\Microsoft Sync Framework\2.1\Runtime\ADO.NET\V3.1\x86)
    • Marked as answer by LogDoctor Monday, October 18, 2010 9:55 AM
    Friday, October 15, 2010 11:56 PM

All replies

  • have you checked your project references and check which version of Microsoft.Synchronization.Data.SqlServerCe is it using?

     

    Thursday, October 14, 2010 3:56 PM
  • Hi JuneT

    Name: Microsoft.Synchronization.Data.SqlServerCe

    Version: 3.5.0.0

    Runtime Version: v2.0.50727


    Friday, October 15, 2010 12:02 PM
  • can you try referencing the assembly from the 2.1 folder instead? (C:\Program Files (x86)\Microsoft Sync Framework\2.1\Runtime\ADO.NET\V3.1\x86)
    • Marked as answer by LogDoctor Monday, October 18, 2010 9:55 AM
    Friday, October 15, 2010 11:56 PM
  • Thanks JuneT, much appreciated

    I'm on to finding the next obfuscated roadblock

     

     

    Monday, October 18, 2010 9:58 AM