Delen via


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)

Syntax

'Declaration
Public Property SelectConflictUpdatedRowsCommand As IDbCommand
'Usage
Dim instance As SyncAdapter
Dim value As IDbCommand

value = instance.SelectConflictUpdatedRowsCommand

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

/** @property */
public void set_SelectConflictUpdatedRowsCommand (IDbCommand value)
public function get SelectConflictUpdatedRowsCommand () : IDbCommand

public function set SelectConflictUpdatedRowsCommand (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. 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 ClientInsertServerInsert, ClientUpdateServerUpdate, and ClientDeleteServerUpdate conflicts.

Example

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

See Also

Reference

SyncAdapter Class
SyncAdapter Members
Microsoft.Synchronization.Data.Server Namespace