EntityDataSource,Select * From?

时间:2011-01-17 07:24:41

标签: asp.net entitydatasource

例如,

    <asp:EntityDataSource ID="edsPatient" runat="server" 
        ConnectionString="name=ReferralDBEntities" 
        DefaultContainerName="ReferralDBEntities" EnableFlattening="False" 
        EntitySetName="Patients" 
        Select="it, (it.FirstName + it.LastName) as FullName"

        >

但是它没有执行到SQL:

Select p.*, (p.FirstName + p.LastName) as FullName from Patients p

EntityDataSource是否不支持通配符?

2 个答案:

答案 0 :(得分:2)

<asp:TemplateField HeaderText="CoachName" SortExpression="FullName">
<ItemTemplate>
<asp:DropDownList ID="DDLPeopleID" runat="server"  CssClass="dropdown"
DataSourceID="PeopleEntityDS" DataTextField="FullName"  AppendDataBoundItems="true"
DataValueField="PeopleID"   SelectedValue='<%# Bind("CoachID") %>'>
<asp:ListItem Text="" value=""></asp:ListItem> </asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>

   <asp:EntityDataSource ID="PeopleEntityDS" runat="server" 
        ConnectionString="name=EQnetTableEntities" 
        DefaultContainerName="EQnetTableEntities" 
        EntitySetName="People"  AutoGenerateWhereClause ="false"
        Select="it.[PeopleID],(it.[FirstName]+' '+it.[LastName]) as FullName" OrderBy="it.PeopleID" 
         EnableFlattening="False">
    </asp:EntityDataSource>

答案 1 :(得分:1)

asp:TemplateField   => DataTextField="FullName"  
EntityDatasource    =>  Select="it.[PeopleID],(it.[FirstName]+' '+it.[LastName]) as FullName"