我有一个entity datasource
并且我想过滤它(created_on)以仅显示最大日期。我该怎么做呢?
<asp:EntityDataSource ID="Payroll_DetailsDS" runat="server"
ConnectionString="name=sspEntities" DefaultContainerName="sspEntities"
EnableDelete="True" EnableFlattening="False" EnableInsert="True"
EnableUpdate="True" EntitySetName="Payroll_Details"
OrderBy="it.[Payslip_no] desc" EntityTypeFilter="" Select=""
Where="it.Status = "COM"">
</asp:EntityDataSource>
目前,数据源仅按 it.status 过滤。我也会过滤it.created_on = Max(created_On)
..这就是我想要的想法,不知道如何得到它。
我能够得到类似的东西,linq
而且效果很好。只需要它entity datasource
。
var testquery = from d in context.Payroll_Details
where d.Created_on == ((from b in context.Payroll_Details
where b.Employee_Personal_InfoEmp_id == xyz.PD_EmpPersonal_Id
select b.Created_on).Max())
select new
{
d.Employee_Personal_InfoEmp_id,
d.Basic_Pay_YTD
};
var r = testquery.SingleOrDefault();