asp.net.ph

SqlDataSource.InsertCommand Property

System.Web.UI.WebControls Namespace   SqlDataSource Class


.NET Framework version 2.0

Sets or retrieves the SQL string that the SqlDataSource control uses to insert data into the underlying database.

Syntax


Inline <asp:SqlDataSource insertcommand = strSQL ... >
Script SqlDataSource.InsertCommand [ = strSQL ]

Property Value


strSQL An SQL string that the SqlDataSource uses to insert data.

The property is read/write with no default value.

Remarks

Because different database products use different varieties of SQL, the syntax of the SQL string depends on the current ADO.NET provider being used, which is identified by the ProviderName property. If the SQL string is a parameterized query or command, the placeholder of the parameter also depends on the ADO.NET provider being used. For example, if the provider is the System.Data.SqlClient, which is the default provider for the SqlDataSource class, the placeholder of the parameter is '@parameterName'. However, if the provider is set to the System.Data.Odbc or System.Data.OleDb, the placeholder of the parameter is '?'. For more information on parameterized SQL queries and commands, see Using Parameters with the SqlDataSource Control.

The InsertCommand can be an SQL string or the name of a stored procedure, if the data source supports stored procedures.

This property delegates to the InsertCommand property of the SqlDataSourceView that is associated with the SqlDataSource control.

NOTE: For security purposes, the InsertCommand property is not stored is view state. Because it is possible to decode the contents of view state on the client, storing sensitive information about the database structure in view state could result in an information disclosure vulnerability.

Skip Navigation Links



Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph