EntityDataSource.CommandParameters Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient la collection de paramètres de la requête.
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
Valeur de propriété
Qui ParameterCollection contient les paramètres passés à la commande de requête.
- Attributs
Exemples
L’exemple suivant fournit le texte de commande Entity SQL qui retourne une collection d’objets Product.
<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>
L’exemple suivant retourne une série de colonnes projetées :
<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>
Remarques
La CommandParameters propriété est utilisée pour accéder aux ParameterCollection paramètres passés à une requête Entity SQL explicite spécifiée à l’aide de la CommandText propriété.