SqlDataSourceView Class

 

Supports the SqlDataSource control and provides an interface for data-bound controls to perform SQL data operations against relational databases.

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

System.Object
  System.Web.UI.DataSourceView
    System.Web.UI.WebControls.SqlDataSourceView
      System.Web.UI.WebControls.AccessDataSourceView

Public Class SqlDataSourceView
	Inherits DataSourceView
	Implements IStateManager

NameDescription
System_CAPS_pubmethodSqlDataSourceView(SqlDataSource, String, HttpContext)

Initializes a new instance of the SqlDataSourceView class setting the specified SqlDataSource control as the owner of the current view.

NameDescription
System_CAPS_pubpropertyCancelSelectOnNullParameter

Gets or sets a value indicating whether a data retrieval operation is canceled when any parameter that is contained in the SelectParameters collection evaluates to null.

System_CAPS_pubpropertyCanDelete

Gets a value indicating whether the SqlDataSourceView object that is associated with the current SqlDataSource control supports the delete operation.(Overrides DataSourceView.CanDelete.)

System_CAPS_pubpropertyCanInsert

Gets a value indicating whether the SqlDataSourceView object that is associated with the current SqlDataSource control supports the insert operation.(Overrides DataSourceView.CanInsert.)

System_CAPS_pubpropertyCanPage

Gets a value indicating whether the SqlDataSourceView object that is associated with the current SqlDataSource control supports the paging of retrieved data.(Overrides DataSourceView.CanPage.)

System_CAPS_pubpropertyCanRetrieveTotalRowCount

Gets a value indicating whether the SqlDataSourceView object that is associated with the current SqlDataSource control supports retrieving the total number of data rows, in addition to the set of data.(Overrides DataSourceView.CanRetrieveTotalRowCount.)

System_CAPS_pubpropertyCanSort

Gets a value indicating whether the SqlDataSourceView object that is associated with the current SqlDataSource control supports a sorted view on the retrieved data.(Overrides DataSourceView.CanSort.)

System_CAPS_pubpropertyCanUpdate

Gets a value indicating whether the SqlDataSourceView object that is associated with the current SqlDataSource control supports the update operation.(Overrides DataSourceView.CanUpdate.)

System_CAPS_pubpropertyConflictDetection

Gets or sets the value indicating how the SqlDataSource control performs updates and deletes when data in a row in the underlying database changes during the time of the operation.

System_CAPS_pubpropertyDeleteCommand

Gets or sets the SQL string that the SqlDataSourceView uses to delete data from the underlying database.

System_CAPS_pubpropertyDeleteCommandType

Gets or sets a value indicating whether the text in the DeleteCommand property is a SQL statement or the name of a stored procedure.

System_CAPS_pubpropertyDeleteParameters

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

System_CAPS_protpropertyEvents

Gets a list of event-handler delegates for the data source view.(Inherited from DataSourceView.)

System_CAPS_pubpropertyFilterExpression

Gets or sets a filtering expression that is applied when the Select method is called.

System_CAPS_pubpropertyFilterParameters

Gets a collection of parameters that are associated with any parameter placeholders in the FilterExpression string.

System_CAPS_pubpropertyInsertCommand

Gets or sets the SQL string that the SqlDataSourceView object uses to insert data into the underlying database.

System_CAPS_pubpropertyInsertCommandType

Gets or sets a value indicating whether the text in the InsertCommand property is a SQL statement or the name of a stored procedure.

System_CAPS_pubpropertyInsertParameters

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

System_CAPS_protpropertyIsTrackingViewState

Gets a value indicating whether the SqlDataSourceView object is saving changes to its view state.

System_CAPS_pubpropertyName

Gets the name of the data source view.(Inherited from DataSourceView.)

System_CAPS_pubpropertyOldValuesParameterFormatString

Gets or sets a format string to apply to the names of any parameters that are passed to the Delete or Update method.

System_CAPS_protpropertyParameterPrefix

Gets the string that is used to prefix a parameter placeholder in a parameterized SQL query.

System_CAPS_pubpropertySelectCommand

Gets or sets the SQL string that the SqlDataSourceView object uses to retrieve data from the underlying database.

System_CAPS_pubpropertySelectCommandType

Gets or sets a value indicating whether the text in the SelectCommand property is a SQL query or the name of a stored procedure.

System_CAPS_pubpropertySelectParameters

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

System_CAPS_pubpropertySortParameterName

Gets or sets the name of a stored procedure parameter that is used to sort retrieved data when data retrieval is performed using a stored procedure.

System_CAPS_pubpropertyUpdateCommand

Gets or sets the SQL string that the SqlDataSourceView object uses to update data in the underlying database.

System_CAPS_pubpropertyUpdateCommandType

Gets or sets a value indicating whether the text in the UpdateCommand property is a SQL statement or the name of a stored procedure.

System_CAPS_pubpropertyUpdateParameters

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

NameDescription
System_CAPS_pubmethodCanExecute(String)

Determines whether the specified command can be executed.(Inherited from DataSourceView.)

System_CAPS_pubmethodDelete(IDictionary, IDictionary)

Performs a delete operation using the DeleteCommand SQL string, any parameters that are specified in the DeleteParameters collection, and the values that are in the specified keys and oldValues collections.

System_CAPS_pubmethodDelete(IDictionary, IDictionary, DataSourceViewOperationCallback)

Performs an asynchronous delete operation on the list of data that the DataSourceView object represents.(Inherited from DataSourceView.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodExecuteCommand(String, IDictionary, IDictionary)

Executes the specified command.(Inherited from DataSourceView.)

System_CAPS_pubmethodExecuteCommand(String, IDictionary, IDictionary, DataSourceViewOperationCallback)

Executes the specified command.(Inherited from DataSourceView.)

System_CAPS_protmethodExecuteDelete(IDictionary, IDictionary)

Performs a delete operation using the DeleteCommand SQL string, any parameters that are specified in the DeleteParameters collection, and the values that are in the specified keys and oldValues collections.(Overrides DataSourceView.ExecuteDelete(IDictionary, IDictionary).)

System_CAPS_protmethodExecuteInsert(IDictionary)

Performs an insert operation using the InsertCommand SQL string, any parameters that are specified in the InsertParameters collection, and the values that are in the specified values collection.(Overrides DataSourceView.ExecuteInsert(IDictionary).)

System_CAPS_protmethodExecuteSelect(DataSourceSelectArguments)

Retrieves data from the underlying database using the SelectCommand SQL string and any parameters that are in the SelectParameters collection.(Overrides DataSourceView.ExecuteSelect(DataSourceSelectArguments).)

System_CAPS_protmethodExecuteUpdate(IDictionary, IDictionary, IDictionary)

Performs an update operation using the UpdateCommand SQL string, any parameters that are in the UpdateParameters collection, and the values that are in the specified keys, values, and oldValues collections.(Overrides DataSourceView.ExecuteUpdate(IDictionary, IDictionary, IDictionary).)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInsert(IDictionary)

Performs an insert operation using the InsertCommand SQL string, any parameters that are specified in the InsertParameters collection, and the values that are in the specified values collection.

System_CAPS_pubmethodInsert(IDictionary, DataSourceViewOperationCallback)

Performs an asynchronous insert operation on the list of data that the DataSourceView object represents.(Inherited from DataSourceView.)

System_CAPS_protmethodLoadViewState(Object)

Restores the previously saved view state for the data source view.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnDataSourceViewChanged(EventArgs)

Raises the DataSourceViewChanged event.(Inherited from DataSourceView.)

System_CAPS_protmethodOnDeleted(SqlDataSourceStatusEventArgs)

Raises the Deleted event after the SqlDataSource control has completed a delete operation.

System_CAPS_protmethodOnDeleting(SqlDataSourceCommandEventArgs)

Raises the Deleting event before the SqlDataSource control attempts a delete operation.

System_CAPS_protmethodOnFiltering(SqlDataSourceFilteringEventArgs)

Raises the Filtering event before the SqlDataSource control filters the results of a select operation.

System_CAPS_protmethodOnInserted(SqlDataSourceStatusEventArgs)

Raises the Inserted event after the SqlDataSource control has completed an insert operation.

System_CAPS_protmethodOnInserting(SqlDataSourceCommandEventArgs)

Raises the Inserting event before the SqlDataSource control attempts an insert operation.

System_CAPS_protmethodOnSelected(SqlDataSourceStatusEventArgs)

Raises the Selected event after the SqlDataSource control has completed a data retrieval operation.

System_CAPS_protmethodOnSelecting(SqlDataSourceSelectingEventArgs)

Raises the Selecting event before the SqlDataSource control attempts a data retrieval operation.

System_CAPS_protmethodOnUpdated(SqlDataSourceStatusEventArgs)

Raises the Updated event after the SqlDataSource control has completed an update operation.

System_CAPS_protmethodOnUpdating(SqlDataSourceCommandEventArgs)

Raises the Updating event before the SqlDataSource control attempts an update operation.

System_CAPS_protmethodRaiseUnsupportedCapabilityError(DataSourceCapabilities)

Compares the capabilities that are requested for an ExecuteSelect operation against those that the view supports and is called by the RaiseUnsupportedCapabilitiesError method.(Overrides DataSourceView.RaiseUnsupportedCapabilityError(DataSourceCapabilities).)

System_CAPS_protmethodSaveViewState()

Saves the changes to the view state for the SqlDataSourceView control since the time that the page was posted back to the server.

System_CAPS_pubmethodSelect(DataSourceSelectArguments)

Retrieves data from the underlying database using the SelectCommand SQL string and any parameters that are in the SelectParameters collection.

System_CAPS_pubmethodSelect(DataSourceSelectArguments, DataSourceViewSelectCallback)

Gets a list of data asynchronously from the underlying data storage.(Inherited from DataSourceView.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_protmethodTrackViewState()

Causes the SqlDataSourceView object to track changes to its view state so that the changes can be stored in the StateBag object for the control and persisted across requests for the same page.

System_CAPS_pubmethodUpdate(IDictionary, IDictionary, IDictionary)

Performs an update operation using the UpdateCommand SQL string, any parameters that are in the UpdateParameters collection, and the values that are in the specified keys, values, and oldValues collections.

System_CAPS_pubmethodUpdate(IDictionary, IDictionary, IDictionary, DataSourceViewOperationCallback)

Performs an asynchronous update operation on the list of data that the DataSourceView object represents.(Inherited from DataSourceView.)

NameDescription
System_CAPS_pubeventDataSourceViewChanged

Occurs when the data source view has changed.(Inherited from DataSourceView.)

System_CAPS_pubeventDeleted

Occurs when a delete operation has completed.

System_CAPS_pubeventDeleting

Occurs before a delete operation.

System_CAPS_pubeventFiltering

Occurs before a filter operation.

System_CAPS_pubeventInserted

Occurs when an insert operation has completed.

System_CAPS_pubeventInserting

Occurs before an insert operation.

System_CAPS_pubeventSelected

Occurs when a data retrieval operation has completed.

System_CAPS_pubeventSelecting

Occurs before a data retrieval operation.

System_CAPS_pubeventUpdated

Occurs when an update operation has completed.

System_CAPS_pubeventUpdating

Occurs before an update operation.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.LoadViewState(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IStateManager.LoadViewState(Object).

System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.SaveViewState()

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IStateManager.SaveViewState().

System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.TrackViewState()

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see TrackViewState.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIStateManager.IsTrackingViewState

For a description of this member, see IsTrackingViewState.

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 object 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. For more information, see ASP.NET State Management Overview.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: