Performs an insert operation using the SqlDataSourceView.InsertCommand SQL string, any parameters that are specified in the SqlDataSourceView.InsertParameters collection, and the values that are in the specified values collection.
- values
- An IDictionary of values used with the SqlDataSourceView.InsertCommand property to perform the insert database operation. If there are no parameters associated with the query or if the SqlDataSourceView.InsertCommand property is not a parameterized SQL query, pass null.
A value that represents the number of rows inserted into the underlying database.
The System.Web.UI.WebControls.SqlDataSourceView class implements the inherited System.Web.UI.DataSourceView.ExecuteInsert(IDictionary) method to insert data into a database. Page developers and data-bound control authors do not call the SqlDataSourceView.ExecuteInsert(IDictionary) method directly; instead, use the publicly exposed SqlDataSource.Insert method.
Before the insert operation is performed, the SqlDataSourceView.OnInserting(SqlDataSourceCommandEventArgs) method is called to raise the SqlDataSourceView.Inserting event. You can handle this event to examine the values of the parameters and to perform any preprocessing before an insert.
To perform an insert operation, the System.Web.UI.WebControls.SqlDataSourceView object builds a System.Data.Common.DbCommand object using the SqlDataSourceView.InsertCommand text and any associated SqlDataSourceView.InsertParameters properties, and then executes the System.Data.Common.DbCommand object against the underlying database. After the insert completes, the SqlDataSourceView.OnInserted(SqlDataSourceStatusEventArgs) method is called to raise the SqlDataSourceView.Inserted event. You can handle this event to examine any return values and error codes and to perform any post-processing.