SyncAdapter.SelectConflictUpdatedRowsCommand Property

Gets or sets the query or stored procedure that is used to identify updated rows that conflict with other changes.

Namespace:  Microsoft.Synchronization.Data.Server
Assembly:  Microsoft.Synchronization.Data.Server (in Microsoft.Synchronization.Data.Server.dll)

public IDbCommand SelectConflictUpdatedRowsCommand { get; set; }

Property Value

Type: System.Data.IDbCommand
An IDbCommand object that contains a query or stored procedure.

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. The query or stored procedure that you specify for the SelectConflictUpdatedRowsCommand property selects conflicting rows from the base table in the server database. Sync Framework executes this command if an insert, update, or delete operation returns a @sync_row_count value of 0. This value indicates that the operation failed. This command selects the rows for ClientInsertServerInsertClientUpdateServerUpdate, and ClientDeleteServerUpdate conflicts.

The following code example creates a command that selects conflicting rows from the Customer table. To view this code in the context of a complete example, see How to: Handle Data Conflicts and Errors.

SqlCommand customerUpdateConflicts = new SqlCommand();
customerUpdateConflicts.CommandText =
    "SELECT CustomerId, CustomerName, SalesPerson, CustomerType " +
    "FROM Sales.Customer " +
    "WHERE CustomerId = @CustomerId";
customerUpdateConflicts.Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier);
customerUpdateConflicts.Connection = serverConn;
customerSyncAdapter.SelectConflictUpdatedRowsCommand = customerUpdateConflicts;


Dim customerUpdateConflicts As New SqlCommand()
With customerUpdateConflicts
    .CommandText = _
        "SELECT CustomerId, CustomerName, SalesPerson, CustomerType " _
      & "FROM Sales.Customer " + "WHERE CustomerId = @CustomerId"
    .Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier)
    .Connection = serverConn
End With
customerSyncAdapter.SelectConflictUpdatedRowsCommand = customerUpdateConflicts


Show: