Sqldatasource updating cancel
The Select Command property defines the SQL select statement to execute when the Grid View requests the data from Sql Data Source. The following example demonstrates the Sql Data Source control configured to select data from a stored procedure in the Northwind sample database.
The Sql Data Source control is not limited to only connecting to Microsoft™ SQL Server database. By default, the Sql Data Source control returns a Data View from a Data Set object that contains the query results.
You can configure the Sql Data Source control to return data as a Data Reader instead by setting the Sql Data Source Mode property to "Data Reader".
Because the data queries are specified directly as properties of the data source control, this is sometimes called a two-tier model, because the data queries are still maintained in page code.
For this reason, the Sql Data Source control is usually aimed at small hobbyist or personal sites that do not require a fully encapsulated data middle-tier object. By default, there are four providers included in the . Note that if you change the provider name, you will need to ensure the Connection String and Select Command properties use the correct syntax for the chosen provider.
Like all data source controls, the Sql Data Source control can be declaratively bound to any data-bound control that supports the Data Source ID property.
Sql Data Source is also self-describing about its capabilities (select, insert, update, delete, sort) so that data-bound controls can provide automatic behavior when a capability is present. NET code you would normally write in a page to create a connection and command to query a database.
The Sql Data Source control supports Update operations when its Update Command property is set and Delete operations when its Delete Command property is set to a valid update or delete command or stored procedure.