How to Get n no. of Rows From DataTable

To find n number of rows from datatable
 
Just write a small piece of code and get n no. of rows from datatable.
 
Syntax
 
DataTable newTable=new DataTable();
newTable= oldTable.AsEnumerable().Take(10).CopyToDataTable();
 
Suppose you have 100 of rows in oldTable. Using above line of code you will get 10 rows in newTable.
 
you can replace 10 with your number and easily get no. of rows which you want.
Ebook Download
View all
Learn
View all