Uredi

Deli z drugimi prek


ObjectDataSourceView.ExecuteInsert(IDictionary) Method

Definition

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

protected:
 override int ExecuteInsert(System::Collections::IDictionary ^ values);
protected override int ExecuteInsert (System.Collections.IDictionary values);
override this.ExecuteInsert : System.Collections.IDictionary -> int
Protected Overrides Function ExecuteInsert (values As IDictionary) As Integer

Parameters

values
IDictionary

A IDictionary of parameters used with the 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 Insert.

Exceptions

The CanInsert property returns false.

values is null or empty.

Remarks

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

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

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

Applies to

See also