SyncAdapter.SelectIncrementalDeletesCommand Property
Gets or sets the query or stored procedure that is used to retrieve deletes made in the server database since the last synchronization.
Namespace: Microsoft.Synchronization.Data.Server
Assembly: Microsoft.Synchronization.Data.Server (in Microsoft.Synchronization.Data.Server.dll)
Syntax
'Declaration
Public Property SelectIncrementalDeletesCommand As IDbCommand
Get
Set
'Usage
Dim instance As SyncAdapter
Dim value As IDbCommand
value = instance.SelectIncrementalDeletesCommand
instance.SelectIncrementalDeletesCommand = value
public IDbCommand SelectIncrementalDeletesCommand { get; set; }
public:
property IDbCommand^ SelectIncrementalDeletesCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
member SelectIncrementalDeletesCommand : IDbCommand with get, set
function get SelectIncrementalDeletesCommand () : IDbCommand
function set SelectIncrementalDeletesCommand (value : IDbCommand)
Property Value
Type: System.Data.IDbCommand
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 changes to the server database. For more information, see How to: Specify Snapshot, Download, Upload, and Bidirectional Synchronization. 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.
Examples
The following code example creates a command that selects deleted rows from the Customer_Tombstone table in bidirectional and download-only synchronization scenarios. To view this code in the context of a complete example, see How to: Handle Data Conflicts and Errors.
SqlCommand customerIncrDeletes = new SqlCommand();
customerIncrDeletes.CommandText =
"SELECT CustomerId, CustomerName, SalesPerson, CustomerType " +
"FROM Sales.Customer_Tombstone " +
"WHERE (@sync_initialized = 1 " +
"AND DeleteTimestamp > @sync_last_received_anchor " +
"AND DeleteTimestamp <= @sync_new_received_anchor " +
"AND DeleteId <> @sync_client_id)";
customerIncrDeletes.Parameters.Add("@" + SyncSession.SyncInitialized, SqlDbType.Bit);
customerIncrDeletes.Parameters.Add("@" + SyncSession.SyncLastReceivedAnchor, SqlDbType.Timestamp);
customerIncrDeletes.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.Timestamp);
customerIncrDeletes.Parameters.Add("@" + SyncSession.SyncClientId, SqlDbType.UniqueIdentifier);
customerIncrDeletes.Connection = serverConn;
customerSyncAdapter.SelectIncrementalDeletesCommand = customerIncrDeletes;
Dim customerIncrDeletes As New SqlCommand()
With customerIncrDeletes
.CommandText = _
"SELECT CustomerId, CustomerName, SalesPerson, CustomerType " _
& "FROM Sales.Customer_Tombstone " _
& "WHERE (@sync_initialized = 1 " _
& "AND DeleteTimestamp > @sync_last_received_anchor " _
& "AND DeleteTimestamp <= @sync_new_received_anchor " _
& "AND DeleteId <> @sync_client_id)"
.Parameters.Add("@" + SyncSession.SyncInitialized, SqlDbType.Bit)
.Parameters.Add("@" + SyncSession.SyncLastReceivedAnchor, SqlDbType.Timestamp)
.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.Timestamp)
.Parameters.Add("@" + SyncSession.SyncClientId, SqlDbType.UniqueIdentifier)
.Connection = serverConn
End With
customerSyncAdapter.SelectIncrementalDeletesCommand = customerIncrDeletes