SqlDataSourceView::SelectParameters Property
Gets the parameters collection containing the parameters that are used by the SelectCommand property.
Assembly: System.Web (in System.Web.dll)
public: property ParameterCollection^ SelectParameters { ParameterCollection^ get (); }
Property Value
Type: System.Web.UI.WebControls::ParameterCollectionA ParameterCollection that contains the parameters used by the SelectCommand property.
If the SelectCommand property contains a parameterized SQL query, the SelectParameters 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 SelectParameters 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 retrieve data from the Northwind database in Microsoft SQL Server by setting the SelectCommand property to an SQL query. The SQL query is parameterized and the placeholder in the SelectCommand property is matched to the ControlParameter object that is added to the SelectParameters collection. In this way, the DropDownList control, to which the ControlParameter is bound, acts as a filter for what is displayed in the ListBox control.
Note: |
|---|
Because the parameter is used in a WHERE clause, the use of the SelectParameters property in this code example is functionally equivalent to using both the FilterExpression and FilterParameters properties. |
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note: