开发者

Datatable -filter records with linq based on some internal index

开发者 https://www.devze.com 2023-02-11 15:02 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消