views:

25

answers:

0

The following codes that disables tracking works fine:

SqlCeConnection loSqlCeConnection1 = new SqlCeConnection(Global.ConnectionStringSdf);  
loSqlCeConnection1.Open();  
SqlCeChangeTracking loTracker1 = new SqlCeChangeTracking(loSqlCeConnection1);  
loTracker1.DisableTracking("ActivityLog");  
loSqlCeConnection1.Close()  

However the following code that enables tracking throws an error:

SqlCeConnection loSqlCeConnection2 = new SqlCeConnection(Global.ConnectionStringSdf);  
loSqlCeConnection2.Open();  
SqlCeChangeTracking loTracker2 = new SqlCeChangeTracking(loSqlCeConnection2);  
loTracker2.EnableTracking("ActivityLog",TrackingKeyType.PrimaryKey,TrackingOptions.All);  
loSqlCeConnection2.Close();  

System.InvalidOperationException was unhandled
Message=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.

The referenced table does have a primary key.

Seems pretty simple and straight forward... what am I missing?

Thanks in advance for your help.

Doug