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

public int Insert (IDictionary values)

Parameters

values
A IDictionary collection 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.

Remarks

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

The ObjectDataSourceView.Insert(IDictionary) method calls the ObjectDataSourceView.ExecuteInsert(IDictionary) method, passing the values collection.

Requirements

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