Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi is there any way to select top 5 rows from a daat table without iteration?
Posted
Comments
Sandeep Mewara 14-Jul-10 3:55am    
What about just returning 5 records at a time?

Please elaborate more, why you don't wanna iterate over the datatable rows? you can use lambda expressions if you are working on c# 3.0.
 
Share this answer
 
You can try LINQ.

C#
var result = DataTable1.AsEnumerable().Take(5);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900