Search code examples
c#asp.netweb-controlsentitydatasource

EntityDataSource control and SELECT TOP(N)


i use asp.net 4 and EF.

I have a EntityDataSource and I would like select only the TOP 10 records from my DataBase, Example SELECT TOP(10).

Here my code, how can I do it? Thanks

<asp:EntityDataSource ID="uxEntityDataSourceEndingSponsoredContents" runat="server"
    ConnectionString="name=CmsConnectionStringEntityDataModel" 
    DefaultContainerName="CmsConnectionStringEntityDataModel" EntitySetName="CmsSponsoredContents"
    OrderBy="it.EffectiveEndDate ASC" EnableFlattening="False" CommandText="" 
    EntityTypeFilter="">
</asp:EntityDataSource>

Solution

  • You have to use top(n)

    Select="top(10) Name, Address"