Linq Exception: Function can only be invoked from linq to entities

asp.net-mvc-4 c# entity-framework linq

Question

I possessStudentReceipts table that containsReceiptNo as string(001,002,003,..,099,..) .

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.

1
7
3/25/2016 8:38:29 AM

Accepted Answer

ZZZ_tmp
12
3/25/2016 8:49:26 AM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow