System.Web.UI.WebControls Namespace
.NET Framework version 2.0
Supports the SqlDataSource control and provides an interface for data-bound controls to perform SQL data operations against relational databases.
Visibility |
Name |
Value Type |
Accessibility |
public |
CancelSelectOnNullParameter
|
Boolean |
[ Get , Set ] |
public |
CanDelete
|
Boolean |
[ Get ] |
public |
CanInsert
|
Boolean |
[ Get ] |
public |
CanPage
|
Boolean |
[ Get ] |
public |
CanRetrieveTotalRowCount
|
Boolean |
[ Get ] |
public |
CanSort
|
Boolean |
[ Get ] |
public |
CanUpdate
|
Boolean |
[ Get ] |
public |
ConflictDetection
|
ConflictOptions |
[ Get , Set ] |
public |
DeleteCommand
|
String |
[ Get , Set ] |
public |
DeleteCommandType
|
SqlDataSourceCommandType |
[ Get , Set ] |
public |
DeleteParameters
|
ParameterCollection |
[ Get ] |
public |
FilterExpression
|
String |
[ Get , Set ] |
public |
FilterParameters
|
ParameterCollection |
[ Get ] |
public |
InsertCommand
|
String |
[ Get , Set ] |
public |
InsertCommandType
|
SqlDataSourceCommandType |
[ Get , Set ] |
public |
InsertParameters
|
ParameterCollection |
[ Get ] |
public |
OldValuesParameterFormatString
|
String |
[ Get , Set ] |
public |
SelectCommand
|
String |
[ Get , Set ] |
public |
SelectCommandType
|
SqlDataSourceCommandType |
[ Get , Set ] |
public |
SelectParameters
|
ParameterCollection |
[ Get ] |
public |
SortParameterName
|
String |
[ Get , Set ] |
public |
UpdateCommand
|
String |
[ Get , Set ] |
public |
UpdateCommandType
|
SqlDataSourceCommandType |
[ Get , Set ] |
public |
UpdateParameters
|
ParameterCollection |
[ Get ] |
|
The SqlDataSourceView class is intended primarily to be used by data-bound controls, and not as a programmable object in page code.
ASP.NET data source controls contain one or more lists of data, represented by data source view objects. The SqlDataSourceView class extends the DataSourceView class, defines the capabilities of the SqlDataSource control with which it is associated, and implements the basic data functionality for the data source control. The SqlDataSourceView class implements the data functionality for the SqlDataSource control, including the Select, Update, Insert, and Delete operations, sorting, filtering, and managing settings that are kept in view state.
Although the SqlDataSourceView is not directly exposed to page developers by the SqlDataSource control, many of its properties are. The most basic operation that a data source view performs is data retrieval from the underlying database using the Select method, which retrieves an IEnumerable collection of data items. The SqlDataSourceView class implements data retrieval from relational databases using SQL queries. The SQL queries can be parameterized for greater flexibility and security. The following data retrieval methods, properties, and events are implemented by the SqlDataSourceView and exposed directly by its SqlDataSource control to page developers and other callers:
The SqlDataSourceView object supports updating data in a relational database using SQL commands. The SQL commands can be parameterized for greater flexibility and security. Data-bound controls, such as the GridView and DetailsView, can be configured to perform updates automatically using the SqlDataSourceView, while other controls cannot. The following update methods, properties, and events are implemented by the SqlDataSourceView and exposed directly by its SqlDataSource control to page developers and other callers:
The SqlDataSourceView supports inserting new rows of data into a relational database. The SQL commands that are specified in the InsertCommand property can be parameterized for greater flexibility and security. Data-bound controls, such as the GridView and DetailsView, can be configured to perform inserts automatically using the SqlDataSourceView, while other controls cannot. The following insert methods, properties, and events are implemented by the SqlDataSourceView and exposed directly by its SqlDataSource control to page developers and other callers:
The SqlDataSourceView object also supports deleting data from a relational database. As with other commands, the SQL commands that are specified in the DeleteCommand property can be parameterized for greater flexibility and security. Data-bound controls, such as the GridView and DetailsView, can be configured to perform deletes automatically using the SqlDataSourceView, while other controls cannot. The following delete methods, properties, and events are implemented by the SqlDataSourceView and exposed directly by its SqlDataSource control to page developers and other callers:
Data retrieval is more powerful when the clause that is used to filter the data during data retrieval is dynamic. In other words, an SQL query with a static WHERE clause is not as flexible and powerful as an SQL query where the values in the WHERE clause are bound to values that can change, such as values that are displayed in controls on a Web Forms page. Instead of rebuilding an SQL query and setting the SelectCommand property on every page load, you can use the FilterExpression and FilterParameters properties to apply dynamic filtering to data retrieval. These properties are implemented by the SqlDataSourceView and exposed directly by its SqlDataSource control to data-bound controls and other callers.
You can sort the data that you retrieve with the SqlDataSource control by adding an ORDER BY clause, which causes the database to perform the ordering for you when you retrieve data or by ordering the data in memory after it is retrieved. You can supply a sorting expression to the SqlDataSourceView by setting the SortExpression property of the DataSourceSelectArguments object that is passed to the Select method. The syntax for the SortExpression property is the same as the syntax for a DataView.Sort property. If you use a stored procedure to retrieve data, you can also use the SortParameterName property to specify a parameter that is used specifically for sorting the results of a stored procedure call.
When more than one user can change the database concurrently, there is the potential for concurrency conflict. The SqlDataSource control has controls concurrency through the SqlDataSource.ConflictDetection property. The functionality is implemented in the SqlDataSourceView.ConflictDetection property.
Like many other Web server controls, the SqlDataSourceView implements the IStateManager interface and uses view state to track its state across page requests. Implementations of the IsTrackingViewState and property and the LoadViewState, SaveViewState, and TrackViewState methods are provided to enable view state tracking for the control.