EntityDataSource连接两个字段

时间:2011-03-22 09:32:38

标签: asp.net entity-framework

我有EDSC,我尝试在select语句中连接两列。我尝试这样的事情:

<asp:EntityDataSource ID="srcData" runat="server" ConnectionString="name=edm"
DefaultContainerName="edm" EnableFlattening="False" EntitySetName="Staff"
Select="it.[StaffID], NewName = it.[Staff_Name] + it.[Staff_Surname]" Where="it.Retired=False">

有没有办法做这样的事情:NewName = it。[Staff_Name] + it。[Staff_Surname]

1 个答案:

答案 0 :(得分:3)

您可以在EntityDataSource的AS属性中使用Select

Select="it.StaffID, it.Staff_Name + it.Staff_Surname AS NewName"