I have an entity datasource
and i would like to filter it (created_on) to show only the max date. How do i go about doing it?
<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>
Right now the data source is only filtering by it.status. I would to filter also by it.created_on = Max(created_On)
.. thats the idea of what i want, dont know how to get it.
i was able to get something similar in linq
and it worked fine. just need it in 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();