table that contains
In order to increase the receipt number for the next transaction, I need to receive the previous transaction's data.
I have tried this.
var _lastGeneratedRecDetails = _db.StudentReceipts .AsEnumerable() .Where(r => r.Status == true && EntityFunctions.TruncateTime(r.DueDate.Value) >= _startDate.Date && EntityFunctions.TruncateTime(r.DueDate.Value) <= _endDate.Date) .OrderByDescending(x => Int32.Parse(x.ReceiptNo)) .FirstOrDefault();
However, I'm encountering the following exception there.
this function can only be invoked from linq to entities
Any assistance would be much appreciated.