次の方法で共有


SelectIncrementalInsertsCommand プロパティ

最後に同期した後にサーバー データベースで行われた挿入を取得するために使用されるクエリまたはストアド プロシージャを取得または設定します。

名前空間:  Microsoft.Synchronization.Data.Server
アセンブリ:  Microsoft.Synchronization.Data.Server (Microsoft.Synchronization.Data.Server.dll 内)

構文

'宣言
Public Property SelectIncrementalInsertsCommand As IDbCommand
    Get
    Set
'使用
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);
}
member SelectIncrementalInsertsCommand : IDbCommand with get, set
function get SelectIncrementalInsertsCommand () : IDbCommand
function set SelectIncrementalInsertsCommand (value : IDbCommand)

プロパティ値

型 : System.Data. . :: . .IDbCommand
クエリまたはストアド プロシージャを格納する IDbCommand オブジェクト。

説明

同期アダプター コマンドにより、サーバー データベースから選択しサーバー データベースに変更を適用するのに使用されるクエリとストアド プロシージャを指定できるようになります。詳細については、「スナップショット、ダウンロード、アップロード、および双方向の各同期を指定する方法」を参照してください。各コマンドは、同期中に値を渡すことができるセッション変数を使用します。これらの変数は、ADO.NET コマンドのクエリやストアド プロシージャに対する他のパラメーターと同じように指定します。詳細については、「セッション変数を使用する方法」を参照してください。

次のコード例は、双方向でダウンロードのみの同期シナリオで挿入された行を Customer テーブルから選択し、すべての種類の同期で初期化のためのテーブル スキーマを選択するコマンドを作成します。完全なコンテキスト例でこのコードを表示するには、「データの競合とエラーを処理する方法」を参照してください。

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

参照

参照

SyncAdapterクラス

SyncAdapter メンバー

Microsoft.Synchronization.Data.Server 名前空間