使用实体框架从表中获取前10个值 [英] get first 10 values from a table using entity framework

查看:73
本文介绍了使用实体框架从表中获取前10个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在研究实体框架.如何使用实体框架从表中获取前10个值?我只需要查询.我已经用谷歌搜索了很多,但是没有得到确切的结果.

在此先感谢.

Hi,

I am studying the entity framework. How can I get the first 10 values from a table using entity framework? I need the query only. I already googled it a lot but I didn''t get an exact result.

Thanks in advance.

推荐答案

如果您从2005年开始使用SQL Server,请执行以下操作:
SELECT TOP 10 ...


在var list中设置列表后,
If you''re using SQL Server from 2005 upward do something like:
SELECT TOP 10 ...


//after you set up your list in var list = ... do this:
list = list.Take(10);



那应该给你10行.

问候,

曼弗雷德(Manfred)



That should give you your 10 rows.

Regards,

Manfred


这篇关于使用实体框架从表中获取前10个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆