var records = dataSet.Tables[0].Rows.Cast<System.Data.DataRow>().Take(10);
Above line will fetch 10 records from existing dataset. If you want to fetch 4 or 5 records, you only have to change the value inside Take function.
In this blog, i let you know, how to get top 10 records from dataset.
Join the conversation! Your thoughts help the community grow.
Join to leave a comment
Members earn 10 SHARP for a comment, 10 SHARP for a reaction, and 250 SHARP for every blog they publish.
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegisterMembers onlyeBook · .NETCQRS Design Pattern with MediaRDownload nowWrite a blog post and earn +250 SHARP when it is approved.
Write a blog
priti shrivastavaPosted Sep 7, 2020, 6:00 AM EDT
How can i get only 10 records in dataset
Satya SrinivasPosted Aug 21, 2012, 3:26 AM EDT
Informative!