System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate 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

protected override int ExecuteUpdate (IDictionary keys, IDictionary values, IDictionary oldValues)

Parameters

keys
A IDictionary of primary keys to use with the ObjectDataSourceView.UpdateMethod property to perform the update database operation. If there are no keys associated with the method, pass null.
values
A IDictionary of values to be used with the ObjectDataSourceView.UpdateMethod to perform the update database operation. If there are no parameters associated with the method, pass null.
oldValues
A IDictionary that represents the original values in the underlying data store. If there are no parameters associated with the query, pass null.

Returns

The number of rows updated; or -1, if the number is not known. For more information, see ObjectDataSource.Update.

Remarks

The System.Web.UI.WebControls.ObjectDataSourceView class implements the inherited ObjectDataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary) method to update data using a business object. Page developers and data-bound control authors do not call the ObjectDataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary) method directly; instead, use the publicly exposed ObjectDataSource.Update method.

The values that are contained in the keys and values collections are evaluated and merged with any values that are contained by the ObjectDataSourceView.UpdateParameters collection. If the ObjectDataSourceView.ConflictDetection property is set to the System.Web.UI.ConflictOptions.CompareAllValues value, the values that are contained in the oldValues collection are formatted with the ObjectDataSourceView.OldValuesParameterFormatString property and are also merged.

Before the update operation is performed, the ObjectDataSourceView.OnUpdating(ObjectDataSourceMethodEventArgs) method is called to raise the ObjectDataSourceView.Updating event. You can handle this event to examine the values of the parameters and to perform any preprocessing before an update. To perform an update operation, the System.Web.UI.WebControls.ObjectDataSourceView uses reflection to call the method that is identified by the ObjectDataSourceView.UpdateMethod property and any associated parameters in the keys collection, and then executes it. After the operation completes, the ObjectDataSourceView.OnUpdated(ObjectDataSourceStatusEventArgs) method is called to raise the ObjectDataSourceView.Updated event. You can handle this event to examine any return values, error codes, and perform any post-processing.

For more information on returning the number of rows updated, see ObjectDataSourceView.Update(IDictionary, IDictionary, IDictionary).

Requirements

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