SyncAdapter.SelectIncrementalInsertsCommand Property
Gets or sets the query or stored procedure that is used to retrieve inserts 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 SelectIncrementalInsertsCommand As IDbCommand
'Usage
Dim instance As SyncAdapter
Dim value As IDbCommand
value = instance.SelectIncrementalInsertsCommand
instance.SelectIncrementalInsertsCommand = value
public IDbCommand SelectIncrementalInsertsCommand { get; set; }
public:
property IDbCommand^ SelectIncrementalInsertsCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
/** @property */
public IDbCommand get_SelectIncrementalInsertsCommand ()
/** @property */
public void set_SelectIncrementalInsertsCommand (IDbCommand value)
public function get SelectIncrementalInsertsCommand () : IDbCommand
public function set SelectIncrementalInsertsCommand (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 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.
Example
The following code example creates a command that selects inserted rows from the Customer
table in bidirectional and download-only synchronization scenarios; and selects the table schema for initialization in all kinds of synchronization. To view this code in the context of a complete example, see How to: Handle Data Conflicts and Errors.
SqlCommand customerIncrInserts = new SqlCommand();
customerIncrInserts.CommandText =
"SELECT CustomerId, CustomerName, SalesPerson, CustomerType " +
"FROM Sales.Customer " +
"WHERE (InsertTimestamp > @sync_last_received_anchor " +
"AND InsertTimestamp <= @sync_new_received_anchor " +
"AND InsertId <> @sync_client_id)";
customerIncrInserts.Parameters.Add("@" + SyncSession.SyncLastReceivedAnchor, SqlDbType.Timestamp);
customerIncrInserts.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.Timestamp);
customerIncrInserts.Parameters.Add("@" + SyncSession.SyncClientId, SqlDbType.UniqueIdentifier);
customerIncrInserts.Connection = serverConn;
customerSyncAdapter.SelectIncrementalInsertsCommand = customerIncrInserts;
Dim customerIncrInserts As New SqlCommand()
With customerIncrInserts
.CommandText = _
"SELECT CustomerId, CustomerName, SalesPerson, CustomerType " _
& "FROM Sales.Customer " _
& "WHERE (InsertTimestamp > @sync_last_received_anchor " _
& "AND InsertTimestamp <= @sync_new_received_anchor " _
& "AND InsertId <> @sync_client_id)"
.Parameters.Add("@" + SyncSession.SyncLastReceivedAnchor, SqlDbType.Timestamp)
.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.Timestamp)
.Parameters.Add("@" + SyncSession.SyncClientId, SqlDbType.UniqueIdentifier)
.Connection = serverConn
End With
customerSyncAdapter.SelectIncrementalInsertsCommand = customerIncrInserts
See Also
Reference
SyncAdapter Class
SyncAdapter Members
Microsoft.Synchronization.Data.Server Namespace