How to apply paging to a dataset?

How can I apply paging to a dataset? I have a method in which I dynamically build a table from a dataset. Querying the database from which I am getting my dataset is not a problem, but datarows from the dataset are repeating slowly.

To improve performance when loading a page containing many datarows, I want to use the paging ability.

A feature that would be good for the user is the ability of the user to set the page size (the number of lines for each page).

+3
source share
3 answers

DataTable, AsEnumerable(). IEnumerable. LINQ.Skip() .Take().

IEnumerable<DataRow> MyDataPage = MyDataTable.AsEnumerable().Skip(100).Take(10);

101 110 MyDataTable, IEnumerable, , . , DataTable, CopyToDataTable(), :

DataTable NewDT = MyDataPage.CopyToDataTable();

+10

Linq.

ROW_NUMBER() SQL Server 2005

0

Source: https://habr.com/ru/post/1744924/


All Articles