Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the parameter collection for the query.
public:
property System::Web::UI::WebControls::ParameterCollection ^ CommandParameters { System::Web::UI::WebControls::ParameterCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.ParameterCollection CommandParameters { get; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.CommandParameters : System.Web.UI.WebControls.ParameterCollection
Public ReadOnly Property CommandParameters As ParameterCollection
A ParameterCollection that contains the parameters that are passed to the query command.
The following example supplies Entity SQL command text that returns a collection of Product objects.
<asp:EntityDataSource ID="ProductDataSource" runat="server"
CommandText="SELECT value p FROM Products AS p
WHERE p.ProductID
BETWEEN @OrderIdMin AND @OrderIdMax"
ConnectionString="name=AdventureWorksEntities"
DefaultContainerName="AdventureWorksEntities" >
<CommandParameters>
<asp:ControlParameter Name="OrderIdMin"
ControlID="ProductIdMin" Type="Int32"/>
<asp:ControlParameter Name="OrderIdMax"
ControlID="ProductIdMax" Type="Int32" />
</CommandParameters>
</asp:EntityDataSource>
The following example returns a projected series of columns:
<asp:EntityDataSource ID="ProductDataSource" runat="server"
CommandText="SELECT p.ProductID, p.ProductName, p.UnitsOnOrder
FROM Products AS p
WHERE p.ProductID BETWEEN @OrderIDMin AND @OrderIDMax"
ContextTypeName="AdventureWorksModel. AdventureWorksEntities">
<CommandParameters>
<asp:ControlParameter Name="OrderIDMin"
ControlID="ProductIDMinTextBox" Type="Int32"/>
<asp:ControlParameter Name="OrderIDMax"
ControlID="ProductIDMaxTextBox" Type="Int32" />
</CommandParameters>
</asp:EntityDataSource>
The CommandParameters property is used to access the ParameterCollection of parameters that are passed to an explicit Entity SQL query that is specified using the CommandText property.
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in