The below code will retrieve top 10 records from the data table.
DataTable1.AsEnumerable().Take(10);
Note: Add using System.Linq on the top.
If intellesense is not showing up, add reference to System.Core
We can copy these records to another data table as below
DataTable1.AsEnumerable().Take(10).CopyToDataTable();
Happy coding…
No comments:
Post a Comment