Share via


DbSyncAdapter.SelectIncrementalChangesCommand Property

Gets or sets the query or stored procedure that is used to select incremental changes from the local database.

Namespace: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)

Syntax

'Declaration
Public Property SelectIncrementalChangesCommand As IDbCommand
'Usage
Dim instance As DbSyncAdapter
Dim value As IDbCommand

value = instance.SelectIncrementalChangesCommand

instance.SelectIncrementalChangesCommand = value
public IDbCommand SelectIncrementalChangesCommand { get; set; }
public:
property IDbCommand^ SelectIncrementalChangesCommand {
    IDbCommand^ get ();
    void set (IDbCommand^ value);
}
/** @property */
public IDbCommand get_SelectIncrementalChangesCommand ()

/** @property */
public void set_SelectIncrementalChangesCommand (IDbCommand value)
public function get SelectIncrementalChangesCommand () : IDbCommand

public function set SelectIncrementalChangesCommand (value : IDbCommand)

Property Value

An IDbCommand object that contains a query or stored procedure.

Remarks

Synchronization adapter commands enable you to specify the queries and stored procedures that are used to select from and apply data and metadata changes to a peer database. For more information, see How to: Configure Change Tracking and Synchronize Peers. Each command uses session variables that enable you to pass values during synchronization. These variables are specified like other parameters to queries or stored procedures in ADO.NET commands. For more information, see How to: Use Session Variables for Peer-to-Peer Synchronization.

Example

The following code example creates a command that selects incremental changes from the Customer table at a peer. These changes are applied to other peers by using the commands that you specify for the following properties: DeleteCommand, InsertCommand, and UpdateCommand. The command in the example is a stored procedure that is defined in Setup Scripts for Sync Services How-to Topics. To view this code in the context of a complete example, see How to: Configure Change Tracking and Synchronize Peers.

SqlCommand chgsCustomerCmd = new SqlCommand();
chgsCustomerCmd.CommandType = CommandType.StoredProcedure;
chgsCustomerCmd.CommandText = "Sales.sp_Customer_SelectChanges";
chgsCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncMetadataOnly, SqlDbType.Int);
chgsCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncMinTimestamp, SqlDbType.BigInt);
chgsCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncInitialize, SqlDbType.Int);            

adapterCustomer.SelectIncrementalChangesCommand = chgsCustomerCmd;
Dim chgsCustomerCmd As New SqlCommand()

With chgsCustomerCmd
    .CommandType = CommandType.StoredProcedure
    .CommandText = "Sales.sp_Customer_SelectChanges"
    .Parameters.Add("@" + DbSyncSession.SyncMetadataOnly, SqlDbType.Int)
    .Parameters.Add("@" + DbSyncSession.SyncMinTimestamp, SqlDbType.BigInt)
    .Parameters.Add("@" + DbSyncSession.SyncInitialize, SqlDbType.Int)
End With

adapterCustomer.SelectIncrementalChangesCommand = chgsCustomerCmd

See Also

Reference

DbSyncAdapter Class
DbSyncAdapter Members
Microsoft.Synchronization.Data Namespace