Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Ottiene o imposta un oggetto IDbCommand contenente la query o la stored procedure che restituisce un nuovo valore di timestamp dal database peer. Il timestamp definisce il limite superiore del set di modifiche da sincronizzare durante la sessione corrente.
Questa proprietà non è conforme a CLS.
Spazio dei nomi: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)
Sintassi
'Dichiarazione
Public Overridable Property SelectNewTimestampCommand As IDbCommand
'Utilizzo
Dim instance As DbSyncProvider
Dim value As IDbCommand
value = instance.SelectNewTimestampCommand
instance.SelectNewTimestampCommand = value
public virtual IDbCommand SelectNewTimestampCommand { get; set; }
public:
virtual property IDbCommand^ SelectNewTimestampCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
/** @property */
public IDbCommand get_SelectNewTimestampCommand ()
/** @property */
public void set_SelectNewTimestampCommand (IDbCommand value)
public function get SelectNewTimestampCommand () : IDbCommand
public function set SelectNewTimestampCommand (value : IDbCommand)
Valore proprietà
Oggetto IDbCommand contenente una query o una stored procedure.
Osservazioni
La query o la stored procedure specificata per questo comando restituisce un valore timestamp utilizzato per selezionare e applicare set di modifiche a ogni peer. Durante la sessione di sincronizzazione corrente, il comando fornisce un nuovo valore timestamp. Vengono sincronizzate le modifiche eseguite dopo il valore timestamp della sessione di sincronizzazione precedente e prima del nuovo valore timestamp. Il nuovo valore viene quindi archiviato e utilizzato come punto iniziale per la sessione successiva.
Esempio
Nell'esempio di codice seguente viene specificato un comando per recuperare un nuovo valore timestamp da un peer. In questo caso, MIN_ACTIVE_ROWVERSION restituisce un valore timestamp da un database SQL Server. (MIN_ACTIVE_ROWVERSION è stato introdotto in SQL Server 2005 Service Pack 2.) Viene utilizzato un valore timestamp perché le colonne di rilevamento del database peer contengono valori timestamp. Per visualizzare questo codice nel contesto di un esempio completo, vedere Procedura: eseguire il provisioning di un database server per la sincronizzazione in scenari di collaborazione (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
Vedere anche
Riferimento
Classe DbSyncProvider
Membri DbSyncProvider
Spazio dei nomi Microsoft.Synchronization.Data