EnableTracking Method

Enables tracking on the specified table.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

Syntax

'Declaration
Public Sub EnableTracking ( _
    tableName As String, _
    trackingKeyType As TrackingKeyType, _
    trackingOptions As TrackingOptions _
)
'Usage
Dim instance As SqlCeChangeTracking
Dim tableName As String
Dim trackingKeyType As TrackingKeyType
Dim trackingOptions As TrackingOptions

instance.EnableTracking(tableName, trackingKeyType, _
    trackingOptions)
public void EnableTracking(
    string tableName,
    TrackingKeyType trackingKeyType,
    TrackingOptions trackingOptions
)
public:
void EnableTracking(
    String^ tableName, 
    TrackingKeyType trackingKeyType, 
    TrackingOptions trackingOptions
)
member EnableTracking : 
        tableName:string * 
        trackingKeyType:TrackingKeyType * 
        trackingOptions:TrackingOptions -> unit 
public function EnableTracking(
    tableName : String, 
    trackingKeyType : TrackingKeyType, 
    trackingOptions : TrackingOptions
)

Parameters

  • trackingKeyType
    Type: System.Data.SqlServerCe. . :: . .TrackingKeyType
    One of the values of TrackingKeyType that specifies the row key to use for tracked data. The row key uniquely identifies table rows to the tracking system and can be either the primary key of the table or a column of type uniqueidentifier that has the ROWGUIDCOL attribute applied.

Exceptions

Exception Condition
ArgumentOutOfRangeException

trackingOptions is not a valid combination of the TrackingOptions values.

-or-

trackingKeyType is not one of the valid TrackingKeyType values.

Remarks

When tracking is enabled on a table the tracking columns (__sysChangeTxBsn, __sysInsertTxBsn, and __sysTrackingContext) are added to the table. System tables may also be created; for example, the tombstone table (__sysOCSDeletedRows).

Important

A table on which tracking is currently enabled cannot be used in merge replication.

See Also

Reference

SqlCeChangeTracking Class

SqlCeChangeTracking Members

System.Data.SqlServerCe Namespace

TrackingKeyType

TrackingOptions