什么是相当于 TOP 或 LIMIT/OFFSET 的 Linq to SQL? [英] What's the Linq to SQL equivalent to TOP or LIMIT/OFFSET?
本文介绍了什么是相当于 TOP 或 LIMIT/OFFSET 的 Linq to SQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我该怎么做
Select top 10 Foo from MyTable
在 Linq to SQL 中?
in Linq to SQL?
推荐答案
在 VB 中:
from m in MyTable
take 10
select m.Foo
这假设 MyTable 实现了 IQueryable.您可能必须通过 DataContext 或其他一些提供程序访问它.
This assumes that MyTable implements IQueryable. You may have to access that through a DataContext or some other provider.
它还假设 Foo 是 MyTable 中映射到属性名称的列.
It also assumes that Foo is a column in MyTable that gets mapped to a property name.
这篇关于什么是相当于 TOP 或 LIMIT/OFFSET 的 Linq to SQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文