DbSyncAdapter.SelectMetadataForCleanupCommand 屬性
取得或設定用來在中繼資料表中清除資料列的查詢或預存程序。
命名空間: Microsoft.Synchronization.Data
組件: Microsoft.Synchronization.Data (在 microsoft.synchronization.data.dll)
語法
'宣告
Public Property SelectMetadataForCleanupCommand As IDbCommand
'用途
Dim instance As DbSyncAdapter
Dim value As IDbCommand
value = instance.SelectMetadataForCleanupCommand
instance.SelectMetadataForCleanupCommand = value
public IDbCommand SelectMetadataForCleanupCommand { get; set; }
public:
property IDbCommand^ SelectMetadataForCleanupCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
/** @property */
public IDbCommand get_SelectMetadataForCleanupCommand ()
/** @property */
public void set_SelectMetadataForCleanupCommand (IDbCommand value)
public function get SelectMetadataForCleanupCommand () : IDbCommand
public function set SelectMetadataForCleanupCommand (value : IDbCommand)
屬性值
包含查詢或預存程序的 IDbCommand 物件。
備註
同步處理配接器命令可讓您指定查詢和預存程序,用來從對等資料庫選取並套用資料和中繼資料變更至對等資料庫。如需詳細資訊,請參閱 HOW TO:佈建伺服器資料庫來進行共同作業同步處理 (非 SQL Server)。每一個命令都會使用同步處理期間可讓您傳遞值的工作階段變數。指定這些變數與其他參數的指定方式一樣,都是在 ADO.NET 命令中指定到查詢或預存程序中。如需詳細資訊,請參閱 HOW TO:使用共同作業同步處理的工作階段變數。
範例
下列程式碼範例會建立命令,從對等的 Customer_Tracking
資料表刪除資料列。如果資料列與已自基底資料表中刪除的資料列相關聯,通常會在經過一段時間之後刪除。此命令是資料庫提供者的安裝指令碼 HOW-TO 主題中所定義的預存程序。若要在完整範例的內容中檢視這段程式碼,請參閱 HOW TO:清除共同作業同步處理的中繼資料 (非 SQL Server)。
SqlCommand selMetadataCustomerCmd = new SqlCommand();
selMetadataCustomerCmd.CommandType = CommandType.StoredProcedure;
selMetadataCustomerCmd.CommandText = "Sync.sp_Customer_SelectMetadata";
selMetadataCustomerCmd.Parameters.Add("@metadata_aging_in_hours", SqlDbType.Int).Value = MetadataAgingInHours;
selMetadataCustomerCmd.Parameters.Add("@sync_scope_local_id", SqlDbType.Int);
adapterCustomer.SelectMetadataForCleanupCommand = selMetadataCustomerCmd;
Dim selMetadataCustomerCmd As New SqlCommand()
With selMetadataCustomerCmd
.CommandType = CommandType.StoredProcedure
.CommandText = "Sync.sp_Customer_SelectMetadata"
.Parameters.Add("@metadata_aging_in_hours", SqlDbType.Int).Value = MetadataAgingInHours
.Parameters.Add("@sync_scope_local_id", SqlDbType.Int)
End With
adapterCustomer.SelectMetadataForCleanupCommand = selMetadataCustomerCmd
請參閱
參考
DbSyncAdapter 類別
DbSyncAdapter 成員
Microsoft.Synchronization.Data 命名空間