Hi is there any way to select top 5 rows from a data table without iteration?
either you can use linq or for loop the datatable for 5 time and fetch the records in a new datatable. var query = myDataTable. AsEnumerable(). Take(5);
You can click the first cell in the table row, and then press CTRL+SHIFT+RIGHT ARROW. Click the upper-left corner of the table. The following selection arrow appears to indicate that clicking selects the table data in the entire table.
I think, You can use LINQ:
datatable.AsEnumerable().Take(5);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With