Gets or sets an IDbCommand object that contains the query or stored procedure that returns a new timestamp value from the peer database. The timestamp defines the upper bound for the set of changes to be synchronized during the current session.
Assembly: Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)
The query or stored procedure that is specified for this command returns a timestamp value that is used to select and apply sets of changes to each peer. During the current synchronization session, the command provides a new timestamp value. Changes that are made after the timestamp value from the previous synchronization session and before the new timestamp value are synchronized. The new value is then stored and used as the starting point for the next session.
The following code example specifies a command to retrieve a new timestamp value from a peer. In this case, MIN_ACTIVE_ROWVERSION returns a timestamp value from a SQL Server database. (MIN_ACTIVE_ROWVERSION was introduced in SQL Server 2005 Service Pack 2.) A timestamp value is used because the tracking columns in the peer database contain timestamp values. To view this code in the context of a complete example, see How to: Provision a Server Database for Collaborative Synchronization (Non-SQL Server).
SqlCommand selectNewTimestampCommand = new SqlCommand(); string newTimestampVariable = "@" + DbSyncSession.SyncNewTimestamp; selectNewTimestampCommand.CommandText = "SELECT " + newTimestampVariable + " = min_active_rowversion() - 1"; selectNewTimestampCommand.Parameters.Add(newTimestampVariable, SqlDbType.Timestamp); selectNewTimestampCommand.Parameters[newTimestampVariable].Direction = ParameterDirection.Output; sampleProvider.SelectNewTimestampCommand = selectNewTimestampCommand;
Dim newTimestampVariable As String = "@" + DbSyncSession.SyncNewTimestamp Dim selectNewTimestampCommand As New SqlCommand() With selectNewTimestampCommand .CommandText = "SELECT " + newTimestampVariable + " = min_active_rowversion() - 1" .Parameters.Add(newTimestampVariable, SqlDbType.Timestamp) .Parameters(newTimestampVariable).Direction = ParameterDirection.Output End With sampleProvider.SelectNewTimestampCommand = selectNewTimestampCommand