ObjectDataSourceView.Update(IDictionary, IDictionary, IDictionary) 方法

定义

通过调用由 UpdateMethod 属性标识的方法和使用 keysvaluesoldValues 集合中提供的所有参数以执行更新操作。Performs an update operation by calling the method that is identified by the UpdateMethod property and using any parameters that are supplied in the keys, values, or oldValues collections.

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

参数

keys
IDictionary

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

values
IDictionary

应用于数据源的新值的 IDictionaryA IDictionary of new values to apply to the data source. 这些参数与 UpdateMethod 属性指定的方法一起使用以执行更新数据库操作。These parameters are used with the method specified by the UpdateMethod property to perform the update database operation. 如果没有与方法关联的参数,则传递 nullIf there are no parameters associated with the method, pass null.

oldValues
IDictionary

一个 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 delete method, only if the ConflictDetection property is set to the CompareAllValues field.

返回

Int32

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

注解

默认返回值为-1,这表示更新了未知的行数。The default return value is -1, which means that an unknown number of rows were updated. 若要返回不同的值,请设置该 AffectedRows 事件的对象的属性 ObjectDataSourceStatusEventArgs UpdatedTo return a different value, set the AffectedRows property of the ObjectDataSourceStatusEventArgs object of the Updated event. 受影响的行数通常由 Update 业务对象的方法返回,而该值可从事件的参数的属性中获取 ReturnValue ObjectDataSourceStatusEventArgs UpdatedThe number of affected rows is typically returned by the Update method for the business object, and that value is available from the ReturnValue property of the ObjectDataSourceStatusEventArgs parameter of the Updated event.

Update方法调用 ExecuteUpdate 方法,传递 keysvaluesoldValues 参数。The Update method calls the ExecuteUpdate method, passing the keys, values, and oldValues parameters.

适用于

另请参阅