Get top 10 records from dataset

We can easily pic few records from dataset by using this code snippet.

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.

Ebook Download
View all
View all