ObjectDataSourceView.Delete(IDictionary, IDictionary) 方法


执行删除操作,方法是使用指定的 keysoldValues 集合调用由 DeleteMethod 属性标识的业务对象方法。Performs a delete operation by calling the business object method that is identified by the DeleteMethod property using the specified keys and oldValues collections.

 int Delete(System::Collections::IDictionary ^ keys, System::Collections::IDictionary ^ oldValues);
public int Delete (System.Collections.IDictionary keys, System.Collections.IDictionary oldValues);
override this.Delete : System.Collections.IDictionary * System.Collections.IDictionary -> int
Public Function Delete (keys As IDictionary, oldValues As IDictionary) As Integer



用于标识要删除的项的键值的 IDictionaryA IDictionary of the key values used to identify the item to delete. 这些参数与 DeleteMethod 属性一起使用以执行删除操作。These parameters are used with the DeleteMethod property to perform the delete operation. 如果没有与方法关联的参数,则传递 nullIf there are no parameters associated with the method, pass null.


一个 IDictionary,包含用于匹配数据源中的项的其他非键值。A IDictionary that contains the additional non-key values used to match the item in the data source. 仅当 ConflictDetection 属性设置为 CompareAllValues 字段时,才将行值传递给方法。Row values are passed to the method only if the ConflictDetection property is set to the CompareAllValues field.


删除的行数;否则,如果行数未知,则为 -1。The number of rows deleted; otherwise, -1, if the number is not known.


默认值为-1, 表示已删除未知数量的行。The default value is -1, which means that an unknown number of rows were deleted. 若要返回不同的值, 请AffectedRows设置Deleted事件处理ObjectDataSourceStatusEventArgs程序的对象的属性。To return a different value, set the AffectedRows property of the ObjectDataSourceStatusEventArgs object of the Deleted event handler. 受影响的行Delete数通常由业务对象的方法返回, 该值可ReturnValueDeleted事件处理程序的ObjectDataSourceStatusEventArgs参数的属性中获取。The number of affected rows is typically returned by the Delete method for the business object, and that value is available from the ReturnValue property of the ObjectDataSourceStatusEventArgs parameter of the Deleted event handler.

方法调用方法, 传递keysoldValues集合。 ExecuteDelete DeleteThe Delete method calls the ExecuteDelete method, passing the keys and oldValues collections.