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());
But here occurred another error,
Incorrect syntax near 'OFFSET'.
Invalid usage of the option NEXT in the FETCH statement.
How can I solve this ?