Datatable -filter records with linq based on some internal index
I have a datatable with plenty of records. And i have a range like lowerRange = 10 and upperRange = 200. I want the pull the records starting at row 10 till row 200.
Now i don't want to add any new index based column into the datatable. Is there any way with the help of linq, i can pull the set of rows based on some internal datatable index? I guess, the datatable must be maintaining some 开发者_C百科row index implicitly.
Please suggest.
Well, you can use:
var records = table.AsEnumerable().Skip(10).Take(191);
That will use the "natural" order of the DataTable. You'll need to make sure that the DataTable is being populated in a useful order though.
精彩评论