Performs an update operation using the SqlDataSourceView.UpdateCommand SQL string, any parameters that are in the SqlDataSourceView.UpdateParameters collection, and the values that are in the specified keys, values, and oldValues collections.
- keys
- An IDictionary of primary keys to use with the SqlDataSourceView.UpdateCommand property to perform the update database operation. If there are no keys associated with the query or if the SqlDataSourceView.UpdateCommand property is not a parameterized SQL query, pass null.
- values
- An IDictionary of values to use with the SqlDataSourceView.UpdateCommand property to perform the update database operation. If there are no parameters associated with the query or if the SqlDataSourceView.UpdateCommand is not a parameterized SQL query, pass null.
- oldValues
- An IDictionary that represents the original values in the database. If there are no parameters associated with the query or if the SqlDataSourceView.UpdateCommand property is not a parameterized SQL query, pass null.
A value that represents the number of rows updated in the underlying database.
The System.Web.UI.WebControls.SqlDataSourceView class implements the inherited SqlDataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary) method to update data in a database. Page developers and data-bound control authors do not call the SqlDataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary) method directly; instead, use the publicly exposed SqlDataSource.Update method.
The values contained in the keys and values collections are evaluated and merged with any values contained by the SqlDataSourceView.UpdateParameters collection. If the SqlDataSourceView.ConflictDetection property is set to System.Web.UI.ConflictOptions.CompareAllValues, the values contained in the oldValues collection are formatted with the SqlDataSourceView.OldValuesParameterFormatString and also merged.
Before the update operation is performed, the SqlDataSourceView.OnUpdating(SqlDataSourceCommandEventArgs) method is called to raise the SqlDataSourceView.Updating event. You can handle this event to examine the values of the parameters and perform any preprocessing before an update.
To perform the operation, the System.Web.UI.WebControls.SqlDataSourceView builds a System.Data.Common.DbCommand object using the SqlDataSourceView.UpdateCommand text and any associated SqlDataSourceView.UpdateParameters properties, and then executes the System.Data.Common.DbCommand object against the underlying database. After the operation completes, the SqlDataSourceView.OnUpdated(SqlDataSourceStatusEventArgs) method is called to raise the SqlDataSourceView.Updated event. You can handle this event to examine any return values and error codes and to perform any post-processing.