Insert Method (IDictionary)
Collapse the table of content
Expand the table of content

ObjectDataSourceView.Insert Method (IDictionary)

Note: This method is new in the .NET Framework version 2.0.

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

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public int Insert (
	IDictionary values
public int Insert (
	IDictionary values
public function Insert (
	values : IDictionary
) : int



A IDictionary collection of parameters used with the InsertMethod property to perform the insert operation. If there are no parameters associated with the method, pass a null reference (Nothing in Visual Basic).

Return Value

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

Exception typeCondition


The CanInsert property returns false.

The default return value is -1, which means that an unknown number of rows were inserted. To return a different value, set the AffectedRows property of the ObjectDataSourceStatusEventArgs object of the 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 ReturnValue property of the ObjectDataSourceStatusEventArgs object of the Inserted event.

The Insert method calls the ExecuteInsert method, passing the values collection.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2016 Microsoft