ObjectDataSourceView.ExecuteDelete Method

Performs a delete operation using the DeleteMethod method and the specified keys and oldValues collection.

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

protected:
virtual int ExecuteDelete (
	IDictionary^ keys, 
	IDictionary^ oldValues
) override
protected int ExecuteDelete (
	IDictionary keys, 
	IDictionary oldValues
)
protected override function ExecuteDelete (
	keys : IDictionary, 
	oldValues : IDictionary
) : int
Not applicable.

Parameters

keys

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

oldValues

A IDictionary that contains row values that are evaluated, only if the ConflictDetection property is set to the CompareAllValues field.

Return Value

The number of rows deleted; otherwise, -1, if the number is not known. For more information, see Delete.

Exception typeCondition

NotSupportedException

The CanDelete property returns false.

InvalidOperationException

The ConflictDetection property is set to the CompareAllValues value, and no values are passed in the oldValues collection.

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

Before the delete operation is performed, the OnDeleting method is called to raise the Deleting event. You can handle this event to examine the values of the parameters and perform any preprocessing before the Delete method is called.

To perform a delete operation, the ObjectDataSourceView uses reflection to call the method that is identified by the DeleteMethod property and any associated parameters in the keys and oldValues collections, and then executes it. After the operation completes, the OnDeleted method is called to raise the Deleted event. You can handle this event to examine any return values and error codes, and to perform any post-processing.

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: