Performs a delete operation using the SqlDataSourceView.DeleteCommand SQL string, any parameters that are specified in the SqlDataSourceView.DeleteParameters collection, and the values that are in the specified keys and oldValues collections.
- keys
- An IDictionary of object or row key values for the SqlDataSourceView.ExecuteDelete(IDictionary, IDictionary) operation to delete.
- oldValues
- An IDictionary that contains row values that are evaluated only if the SqlDataSourceView.ConflictDetection property is set to the System.Web.UI.ConflictOptions.CompareAllValues value.
A value that represents the number of rows deleted from the underlying database.
The System.Web.UI.WebControls.SqlDataSourceView class implements the inherited System.Web.UI.DataSourceView.ExecuteDelete(IDictionary, IDictionary) method to delete data from a database. Page developers and data-bound control authors do not call the SqlDataSourceView.ExecuteDelete(IDictionary, IDictionary) method directly; instead, use the publicly exposed SqlDataSource.Delete method.
The values that are contained in the keys collection are evaluated and merged with any values that are contained by the SqlDataSourceView.DeleteParameters collection. If the SqlDataSourceView.ConflictDetection property is set to the System.Web.UI.ConflictOptions.CompareAllValues value, the values that are contained in the oldValues collection are formatted with the SqlDataSourceView.OldValuesParameterFormatString property and are also merged.
Before the delete operation is performed, the SqlDataSourceView.OnDeleting(SqlDataSourceCommandEventArgs) method is called to raise the SqlDataSourceView.Deleting event. You can handle this event to examine the values of the parameters and to perform any preprocessing before a delete.
To perform a delete operation, the System.Web.UI.WebControls.SqlDataSourceView object builds a System.Data.Common.DbCommand object using the SqlDataSourceView.DeleteCommand text and any associated SqlDataSourceView.DeleteParameters properties, and then executes the System.Data.Common.DbCommand object against the underlying database. After the delete operation completes, the SqlDataSourceView.OnDeleted(SqlDataSourceStatusEventArgs) method is called to raise the SqlDataSourceView.Deleted event. You can handle this event to examine any return values and error codes and to perform any post-processing.