开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜