System.Web.UI.WebControls.ObjectDataSourceView.Update Method

Performs an update operation by calling the method that is identified by the ObjectDataSourceView.UpdateMethod property and using any parameters that are supplied in the keys, values, or oldValues collections.

Syntax

public int Update (IDictionary keys, IDictionary values, IDictionary oldValues)

Parameters

keys
A IDictionary of the key values used to identify the item to update. These parameters are used with the method specified by the ObjectDataSourceView.UpdateMethod property to perform the update operation. If there are no parameters associated with the method, pass null.
values
A IDictionary of new values to apply to the data source. These parameters are used with the method specified by the ObjectDataSourceView.UpdateMethod property to perform the update database operation. If there are no parameters associated with the method, pass null.
oldValues
A IDictionary that contains the additional non-key values used to match the item in the data source. Row values are passed to the delete method, only if the ObjectDataSourceView.ConflictDetection property is set to the System.Web.UI.ConflictOptions.CompareAllValues field.

Returns

The number of rows updated; otherwise, -1, if the number is not known.

Remarks

The default return value is -1, which means that an unknown number of rows were updated. To return a different value, set the ObjectDataSourceStatusEventArgs.AffectedRows property of the System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs object of the ObjectDataSource.Updated event. The number of affected rows is typically returned by the Update method for the business object, and that value is available from the ObjectDataSourceStatusEventArgs.ReturnValue property of the System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs parameter of the ObjectDataSource.Updated event.

The ObjectDataSourceView.Update(IDictionary, IDictionary, IDictionary) method calls the ObjectDataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary) method, passing the keys, values, and oldValues parameters.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0