Share via


DbSyncAdapter.SelectRowCommand Property

Gets or sets the query or stored procedure that is used to select a specific row given an ID for that row.

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

Syntax

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

value = instance.SelectRowCommand

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

/** @property */
public void set_SelectRowCommand (IDbCommand value)
public function get SelectRowCommand () : IDbCommand

public function set SelectRowCommand (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: Provision a Server Database for Collaborative Synchronization (Non-SQL Server). 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 Collaborative Synchronization (Non-SQL Server).

Example

The following code example creates a command that selects conflicting rows from the Customer table at a peer. The command is a stored procedure that is defined in Setup Scripts for Database Provider How-to Topics. To view this code in the context of a complete example, see How to: Handle Data Conflicts and Errors for Collaborative Synchronization (SQL Server).

SqlCommand selRowCustomerCmd = new SqlCommand();
selRowCustomerCmd.CommandType = CommandType.StoredProcedure;
selRowCustomerCmd.CommandText = "Sync.sp_Customer_SelectRow";
selRowCustomerCmd.Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier);
selRowCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncScopeLocalId, SqlDbType.Int);

adapterCustomer.SelectRowCommand = selRowCustomerCmd;
Dim selRowCustomerCmd As New SqlCommand()

With selRowCustomerCmd
    .CommandType = CommandType.StoredProcedure
    .CommandText = "Sync.sp_Customer_SelectRow"
    .Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier)
    .Parameters.Add("@" + DbSyncSession.SyncScopeLocalId, SqlDbType.Int)
End With

adapterCustomer.SelectRowCommand = selRowCustomerCmd

See Also

Reference

DbSyncAdapter Class
DbSyncAdapter Members
Microsoft.Synchronization.Data Namespace