This documentation is archived and is not being maintained.
EntityDataSource::CommandParameters Property
Visual Studio 2010
Gets the parameter collection for the query.
Assembly: System.Web.Entity (in System.Web.Entity.dll)
[PersistenceModeAttribute(PersistenceMode::InnerProperty)] [BrowsableAttribute(false)] public: property ParameterCollection^ CommandParameters { ParameterCollection^ get (); }
Property Value
Type: System.Web.UI.WebControls::ParameterCollectionA ParameterCollection that contains the parameters that are passed to the query command.
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.
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>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: