I want to get Employee Id 9, so i am using this query
select top (1) EmployeeID from tbl_EmpInfo where EmpId<10 order by 1 desc
How convert ths query to Linq or any other better solution to acheive this.
thanks.
Refer the below link how to work with entity framework
Simple Entity Framework Tutorial in ASP.Net Web Forms with example
Also check the below sample example and implement it as per your code logic.
int Id = 10; var empId = db.tbl_EmpInfo.Where(x => x.EmployeeID < Id).OrderByDescending(x => x.EmployeeID).Select(x => x.EmployeeID).FirstOrDefault();
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.