i have used this query to fetch the Record of the Datatable based on the Pagesize.
IEnumerable<DataRow> query1 = from row in dt.AsEnumerable().Take(page_size).Skip(offset) select row;
Datatable boundTable= query1.CopyToDataTable();
first time when it opens the offset will be =0; it gives 10 records,
next time i pass the offset as 10 to get next ten records,
but it is not giving any enum values. showing me a message says ‘
Enumeration yielded no results
‘
but the dt which i querying has nearly 1000 records. what wrong i made here…
You’re using
SkipandTakein the wrong order. Try this:(I removed the query expression syntax as it wasn’t doing you any favours here.)
You were doing
TakethenSkip– so you were saying something like, “Give me the first ten records, then skip to the eleventh of those ten.” That’s clearly not going to give you any results 🙂The above says, “Skip to the eleventh record, then give me the first ten records that are left.”