共用方式為


DbSyncAdapter.DeleteMetadataCommand 屬性

取得或設定用來從中繼資料表中刪除中繼資料的查詢或預存程序。

命名空間: Microsoft.Synchronization.Data
組件: Microsoft.Synchronization.Data (在 microsoft.synchronization.data.dll)

語法

'宣告
Public Property DeleteMetadataCommand As IDbCommand
'用途
Dim instance As DbSyncAdapter
Dim value As IDbCommand

value = instance.DeleteMetadataCommand

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

/** @property */
public void set_DeleteMetadataCommand (IDbCommand value)
public function get DeleteMetadataCommand () : IDbCommand

public function set DeleteMetadataCommand (value : IDbCommand)

屬性值

包含查詢或預存程序的 IDbCommand 物件。

備註

同步處理配接器命令可讓您指定查詢和預存程序,用來從對等資料庫選取並套用資料和中繼資料變更至對等資料庫。如需詳細資訊,請參閱 HOW TO:佈建伺服器資料庫來進行共同作業同步處理 (非 SQL Server)。每一個命令都會使用同步處理期間可讓您傳遞值的工作階段變數。指定這些變數與其他參數的指定方式一樣,都是在 ADO.NET 命令中指定到查詢或預存程序中。如需詳細資訊,請參閱 HOW TO:使用共同作業同步處理的工作階段變數

範例

下列程式碼範例會建立命令,從對等的 Customer_Tracking 資料表刪除中繼資料資料列。此命令是資料庫提供者的安裝指令碼 HOW-TO 主題中所定義的預存程序。若要在完整範例的內容中檢視這段程式碼,請參閱 HOW TO:佈建伺服器資料庫來進行共同作業同步處理 (非 SQL Server)

SqlCommand delMetadataCustomerCmd = new SqlCommand();
delMetadataCustomerCmd.CommandType = CommandType.StoredProcedure;
delMetadataCustomerCmd.CommandText = "Sync.sp_Customer_DeleteMetadata";
delMetadataCustomerCmd.Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier);
delMetadataCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int);
delMetadataCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncRowTimestamp, SqlDbType.BigInt);
delMetadataCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output;

adapterCustomer.DeleteMetadataCommand = delMetadataCustomerCmd;
Dim delMetadataCustomerCmd As New SqlCommand()

With delMetadataCustomerCmd
    .CommandType = CommandType.StoredProcedure
    .CommandText = "Sync.sp_Customer_DeleteMetadata"
    .Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier)
    .Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int)
    .Parameters.Add("@" + DbSyncSession.SyncRowTimestamp, SqlDbType.BigInt)
    .Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output
End With

adapterCustomer.DeleteMetadataCommand = delMetadataCustomerCmd

請參閱

參考

DbSyncAdapter 類別
DbSyncAdapter 成員
Microsoft.Synchronization.Data 命名空間