System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert Method

Performs an insert operation by calling the business object method that is identified by the ObjectDataSourceView.InsertMethod property using the specified values collection.

Syntax

protected override int ExecuteInsert (IDictionary values)

Parameters

values
A IDictionary of parameters used with the ObjectDataSourceView.InsertMethod property to perform the insert operation. If there are no parameters associated with the method, pass null.

Returns

The number of rows inserted; otherwise, -1, if the number is not known. For more information, see erload:System.Web.UI.WebControls.ObjectDataSourceView.Insert.

Remarks

The System.Web.UI.WebControls.ObjectDataSourceView class implements the inherited ObjectDataSourceView.ExecuteInsert(IDictionary) method to insert data into an underlying data store using a business object. Page developers and data-bound control authors do not call the ObjectDataSourceView.ExecuteInsert(IDictionary) method directly; instead, use the publicly exposed erload:System.Web.UI.WebControls.ObjectDataSourceView.Insert method.

Before the insert is performed, the ObjectDataSourceView.OnInserting(ObjectDataSourceMethodEventArgs) method is called to raise the ObjectDataSourceView.Inserting event. You can handle this event to examine the values of the parameters and perform any preprocessing before the ObjectDataSourceView.Insert(IDictionary) method is called.

To perform an insert operation, the System.Web.UI.WebControls.ObjectDataSourceView control uses reflection to call the method that is identified by the ObjectDataSourceView.InsertMethod property and any associated parameters that are in the values collection, and then executes it. After the operation completes, the ObjectDataSourceView.OnInserted(ObjectDataSourceStatusEventArgs) method is called to raise the ObjectDataSourceView.Inserted 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 inserted, see ObjectDataSourceView.Insert(IDictionary).

Requirements

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