Share via


ObjectDataSourceView.ExecuteDelete(IDictionary, IDictionary) 方法

定義

使用 DeleteMethod 方法和指定的 keysoldValues 集合,執行刪除作業。

protected:
 override int ExecuteDelete(System::Collections::IDictionary ^ keys, System::Collections::IDictionary ^ oldValues);
protected override int ExecuteDelete (System.Collections.IDictionary keys, System.Collections.IDictionary oldValues);
override this.ExecuteDelete : System.Collections.IDictionary * System.Collections.IDictionary -> int
Protected Overrides Function ExecuteDelete (keys As IDictionary, oldValues As IDictionary) As Integer

參數

keys
IDictionary

參數的 IDictionary,與 DeleteMethod 屬性搭配使用,以執行刪除作業。 如果沒有任何參數與此方法有關聯,則會傳遞 null

oldValues
IDictionary

IDictionary,其中包含評估的資料列值,只有當 ConflictDetection 屬性設定為 CompareAllValues 欄位時。

傳回

刪除之資料列的數目,如果數目不明,則為 -1。 如需詳細資訊,請參閱Delete

例外狀況

CanDelete 屬性會傳回 false

ConflictDetection 屬性會設為 CompareAllValues 值,且沒有值傳入 oldValues 集合。

備註

類別 ObjectDataSourceView 會實作繼承 ExecuteDelete 的方法,以使用商務物件從基礎資料存放區中刪除資料。 頁面開發人員和資料繫結控制項作者不會直接呼叫 ExecuteDelete 方法;請改用公開的方法 Delete

在執行刪除作業之前, OnDeleting 會呼叫 方法來引發 Deleting 事件。 您可以處理此事件來檢查參數的值,並在呼叫 方法之前 Delete 執行任何前置處理。

若要執行刪除作業,會 ObjectDataSourceView 使用反映來呼叫 屬性所識別 DeleteMethod 的方法,以及 和 oldValues 集合中 keys 任何相關聯的參數,然後加以執行。 作業完成之後, OnDeleted 會呼叫 方法來引發 Deleted 事件。 您可以處理此事件來檢查任何傳回值和錯誤碼,以及執行任何後續處理。

適用於

另請參閱