InsertParameters Property

SqlDataSourceView.InsertParameters Property

 

Gets the parameters collection containing the parameters that are used by the InsertCommand property.

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

[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>]
member InsertParameters : ParameterCollection with get

Property Value

Type: System.Web.UI.WebControls.ParameterCollection

A ParameterCollection that contains the parameters used by the InsertCommand property.

If the InsertCommand property contains a parameterized SQL query, the InsertParameters collection contains any Parameter objects that correspond to the parameter placeholders in the SQL string.

Depending on the ADO.NET provider, the order of the parameters in the InsertParameters collection might be important. The System.Data.OleDb and System.Data.Odbc providers associate the parameters in the collection according to the order in which the parameters appear in the parameterized SQL query. The System.Data.SqlClient provider, which is the default ADO.NET provider for the SqlDataSource control, associates the parameters in the collection by matching the name of the parameter with a placeholder alias in the SQL query. For more information on parameterized SQL queries and commands, see Using Parameters with the SqlDataSource Control.

The following code example demonstrates how to insert data into a database using the SqlDataSource control and a simple Web Forms page. The current data in the table is displayed in the DropDownList control. You can add new records by entering values in the TextBox controls, and then clicking the Insert button. When the Insert button is clicked, the specified values are inserted into the database and the DropDownList is refreshed.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft