Export (0) Print
Expand All

DataSourceView.ExecuteInsert Method

Performs an insert operation on the list of data that the DataSourceView object represents.

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

protected virtual int ExecuteInsert (
	IDictionary values
)
protected int ExecuteInsert (
	IDictionary values
)
protected function ExecuteInsert (
	values : IDictionary
) : int
Not applicable.

Parameters

values

An IDictionary of name/value pairs used during an insert operation.

Return Value

The number of items that were inserted into the underlying data storage.

Exception typeCondition

NotSupportedException

The ExecuteInsert operation is not supported by the DataSourceView.

Data-bound controls can determine whether the ExecuteInsert operation is supported by a data source control by retrieving the DataSourceView object using the GetView method, and checking the CanInsert property.

The values parameter is a set of name/value pairs that represents data columns or fields and corresponding values to insert.

NoteNote:

The DataSourceView class's default implementation is to throw a NotSupportedException exception. If you extend the DataSourceView class, override the ExecuteInsert method if your class supports insertion into the underlying data storage.

The following code example demonstrates how a class that extends the DataSourceView class can override the CanInsert property and the ExecuteInsert method. This code example is part of a larger example provided for the DataSourceView class.

// The CsvDataSourceView does not currently
// permit insertion of a new record. You can
// modify or extend this sample to do so.
public override bool CanInsert {
    get {
        return false;
    }
}
protected override int ExecuteInsert(IDictionary values)
{
    throw new NotSupportedException();
}

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft