Sajid Hussain

Sajid Hussain

  • 1.2k
  • 514
  • 100.6k

How Do I Get Last Record From Table In This Scenior

Jan 9 2015 4:30 PM
i have database table in which i am storing multiple status of same employee ,and then get these record in to the report,it work fine ,problem is here when i add a little bit change in the his status that status add as fresh record because i want to save previous one so can use update method.now i want to get last record of that employee c# code is here
 
 
 
 var incharge = _service.GetEmployeeStatusBySector_Id(sectorId).Where(x => x.DutyType_Id == 7 && x.EmployeeStatusType_Id == 1 && x.IsDutiable == true);             foreach (EmployeeStatus Inchargesector in incharge)             {                 var emp = _service.GetEmployee(Inchargesector.Employee_Id);                   foreach (var empp in incharge)                 {                     dataset.InchargeSector.Rows.Add(Inchargesector.EmployeeShift_Id, emp.Name, emp.RankName, emp.CellNo);                     InchargeSector.Remove(empp);                 }                }
 i cant use it as follow that create problem
var incharge = _service.GetEmployeeStatusBySector_Id(sectorId).Where(x => x.DutyType_Id == 7 && x.EmployeeStatusType_Id == 1 && x.IsDutiable == true).last();
 

Answers (3)