How to get data from a Data table by skipping the first few rows

Hi,

I am reading a database which has 800 records,
I am getting the first 10 records like this:
image

How can I skip the first 10 and get next 10 or so.
Thanks.

Hi,

Can you try Skip method as the following?

out_dt_DispatchRows.AsEnumerable().Skip(10).Take(10).CopyToDataTable()

Please note that if there are 10 or less rows in the datatable, the above (CopyToDataTable method) throws exception because there is no DataRow to convert to Datatable.

Regards,

1 Like

@chauhan.rachita30

if you only need to skip and get then use

out_dt_DispatchRows.AsEnumerable().Skip(10).Take(10).CopyToDataTable

if you want 10 rows each time in a loop or so then in list of items use out_dt_DispatchRows.AsEnumerable().chunks(10) and inside loop use currentitem.CopyToDatatable which gives 10 rows for each iteration till data completes

cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.