gpt4 book ai didi

Linq 选择记录范围

转载 作者:行者123 更新时间:2023-12-02 08:55:33 26 4
gpt4 key购买 nike

    var q = (from Comments in db.tblBlogComments where Comments.blogID == this.ID orderby Comments.date descending select new {
Comments.userID, Comments.comment, Comments.date
});

这会返回我所有的关联记录,我如何最好地只选择记录 #10 到 #20,这样我就不会加载任何冗余数据?

最佳答案

怎么样:

var q = (
from Comments in db.tblBlogComments
where Comments.blogID == this.ID
orderby Comments.date descending
select new { Comments.userID, Comments.comment, Comments.date }).Skip(10).Take(10);

关于Linq 选择记录范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5214153/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com