EntityFrameWork分页
EF分页代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page
{
private int pageindex =int.Parse(HttpContext.Current.Request["page"].ToString());
protected void Page_Load(object sender, EventArgs e)
{
DB_CSM_20150615Entities db = new DB_CSM_20150615Entities();
var list = db.T_TASK.Where(u => u.TASK_ID != null); int recordCount = ;
recordCount = list.Count(); //获取总记录数要在skip前获取
list=list.OrderBy(u=>u.TASK_ID);
list = list.Skip(pageindex*).Take(); //跳过pageindex*10 取10条 foreach (var v in list)
{
Response.Write(v.TASK_ID+"</br>");
} Response.Write(recordCount); }
}
EntityFrameWork分页的更多相关文章
- EntityFramework 分页问题探讨之 OrderBy
应用场景 最近被应用程序中页面加载慢的问题所折磨,看似容易的问题,其实并不容易(已经持续两天时间了),经过"侦查",发现了两个"嫌疑犯": EntityFram ...
- Ling to entity实现分页
Ling to entity实现分页 最近用MVC做的一个项目涉及到分页,中间用了entity framework来查数据库,不用直接写sql语句,方便了很多. 一般分页的思路是获得两个变量的值: 1 ...
- EntityFramework 7 OrderBy Skip Take-计算排序分页 SQL 翻译
先解释一下这个标题的意思,OrderBy 在 Linq 语句中,我们经常使用,比如 OrderBy(b => b.BlogId) 就是对 BlogId 字段进行升序排序,这是针对一个字段的排序, ...
- EntityFramework 4使用存储过程分页
CREATE PROC usp_OrgPage_SQL @pageIndex INT, @pageSize INT, @totalCount INT OUTPUT AS BEGIN SET @tota ...
- EntityFramework进阶(五)- 分页
本系列原创博客代码已在EntityFramework6.0.0测试通过,转载请标明出处 我们创建分页信息类CommonPagedList,包含了字段总条数,总页数,当前页码,页大小,当前页数据. us ...
- mvc,EntityFramework调用分页存储过程
此文讲述mvc4+entityframework6+sqlserver2008环境下调用存储过程,实现分页. 1.分页存储过程代码如下: 分页原理用的row_number()和over()函数实现(没 ...
- EntityFrameWork使用MySql数据库分页的BUG
环境 使用MySQL Connector NET 6.7.4+EF5.0+VS2010 问题描述 IQueryable<T>类型的Where方法和Skip或Take方法一起使用时,生成的S ...
- EntityFramework 优化建议
Entity Framework目前最新版本是6.1.3,当然Entity Framework 7 目前还是预览版,并不能投入正式生产环境,估计正式版16年第一季度会出来,了解过EF7的部分新特性后, ...
- 爱与恨的抉择:ASP.NET 5+EntityFramework 7
EF7 的纠缠 ASP.NET 5 的无助 忘不了你的好 一开始列出的这个博文大纲,让我想到了很久之前的一篇博文:恋爱虽易,相处不易:当EntityFramework爱上AutoMapper,只不过这 ...
随机推荐
- C1 FlexGrid控件 Editor 冲突问题
当给C1FlexGrid控件加入 Checkbox后,添加新行时对新行的Editor 赋新控件时,会冲突如下图: 下面我们借助BeforeRowColChange 事件来解决这个问题: 我 ...
- L4,an exciting trip
expressions: a great number of 许多 in the centre of 在…的中部 sentences: I have just had breakfast. I hav ...
- MVC 创建Word文档
/// <summary> /// 创建一个word /// </summary> /// <returns></returns> public Act ...
- 剑指offer 复杂链表的复制 (有向图的复制)
时间复杂度O(3N) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...
- tomcat服务器设置用户名和密码
conf/tomcat-user.xml <user username="admin" password="1234" roles="manag ...
- 转 SQL 基础--> NEW_VALUE 的使用
--=============================== -- SQL 基础--> NEW_VALUE 的使用 --=============================== 通常 ...
- 管理Fragments(转)
转:原文链接 http://www.cnblogs.com/mengdd/archive/2013/01/09/2853254.html 管理Fragments FragmentManager 为了管 ...
- 绑定网关mac,防arp攻击
netsh i i show innetsh -c i i add neighbors 16 192.168.1.1 08-57-00-51-19-7c
- inline-block的特点
<html> <head> <meta charset="utf-8"> <title></title> <sty ...
- Permission denied: user=xxj, access=WRITE, inode="user":hadoop:supergroup:rwxr-xr-x
在windows中运行eclipse时报错Permission denied: user=xxj, access=WRITE, inode="user":hadoop:superg ...