Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Insert Method (IDictionary)
Collapse the table of content
Expand the table of content

ObjectDataSourceView.Insert Method (IDictionary)

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
)

Parameters

values
Type: System.Collections.IDictionary

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 null.

Return Value

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

ExceptionCondition
NotSupportedException

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Show:
© 2015 Microsoft