Hello,
If there is have more than 10 records, then take only 10,
- var query = from a in context.Advertisements where a.idPartner == partnerid select a;
- count = query.Count();
- if (count > 10)
- return (query.Skip(startIndex).Take(10).ToList());
- else
- return query.ToList();
now the error occured,
The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.
Then I have tried, this code:
- return (query.OrderBy(p=>p.idAdvertisement).Skip(startIndex).Take(10).ToList());
Incorrect syntax near 'OFFSET'.
Invalid usage of the option NEXT in the FETCH statement.
Invalid usage of the option NEXT in the FETCH statement.
How can I solve this ?

Munesh SharmaPosted Apr 21, 2017, 6:55 AM
Ramesh PalanivelPosted Apr 21, 2017, 6:30 AM
{
DesignationId = des.DESIGNATION_ID,
DesignationCode = des.CODE,
DesignationName = des.NAME
}).ToList();
//List
records.Content = (from desig in designation select desig).Skip((page - 1) * 15)
.Take(15).ToList().AsQueryable
records.TotalRecords = (from designationrecords in _entity.M_DESIGNATION select designationrecords).Count();
records.PageSize = 5;
Abhilash J APosted Apr 21, 2017, 6:26 AM
Ramesh PalanivelPosted Apr 21, 2017, 6:23 AM
var query = from a in context.Advertisements where a.idPartner == partnerid select a;
count = query.Count();
if (count > 10)
return Queryable.Skip(query,startIndex).Take(10).ToList());
else
return query.ToList();