when i run this function in my project, i got a FormatException.
but i can run the same LINQ expression in “LinqPad”
private List<TNews> GetPagedEntities(int pagenum, int pagesize, IQueryable<TNews> query)
{
var totalCnt = query.Count();
int recordsCount = (totalCnt < CONST_QUERY_COUNT) ? totalCnt : CONST_QUERY_COUNT;
SetPagerValues(pagenum, pagesize, recordsCount);
var newsRslt = (from m in query
orderby m.PnacDT descending
select m).Take(recordsCount).Skip(pagenum * pagesize).Take(pagesize).ToList();
return newsRslt;
}
ps:CONST_QUERY_COUNT==10000
what does this exception mean?
May be your entity model and the database have some difference. It can be a data type mismatch for a column.