EntityDataSource.CommandParameters プロパティ

定義

クエリのパラメーターのコレクションを取得します。

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

プロパティ値

クエリ コマンドに渡されるパラメーターが格納されている ParameterCollection

属性

次の例では、Product オブジェクトのコレクションを返す Entity SQL コマンド テキストを提供します。

<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>

次の例では、投影された一連の列を返します。

<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>

注釈

プロパティは CommandParameters 、 プロパティを ParameterCollection 使用して指定された明示的な Entity SQL クエリに渡されるパラメーターの に CommandText アクセスするために使用されます。

適用対象