using (EPOSEntities1 db = new EPOSEntities1())
{
List<ActionPerformed> PLUlist = db.ActionPerformeds.ToList();
ActionPerformed Latest_PLU = PLUlist.OrderByDescending(x => x.Date).FirstOrDefault();
}
這將返回存儲的最後一條記錄。但是我現在在表File_Name中添加了另一列,我怎麼才能在這裏添加一個where子句來表示orderByDescending以獲取最新文件,然後從那裏獲得file_Name爲'Sales'的第一條記錄。獲取最後一條記錄後使用where子句?
例如,
File_Name Date
12) Products 11/02/2014
13) Sales 11/02/2014
14) Products 11/02/2014
這會返回記錄13 ??
你爲什麼要拉動整個列表到內存中,以篩選出一個記錄,而不是盡一切濾波的數據庫? – Servy