• 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 = 0;
            recordCount = list.Count(); //获取总记录数要在skip前获取
            list=list.OrderBy(u=>u.TASK_ID);
            list = list.Skip(pageindex*10).Take(10); //跳过pageindex*10 取10条
    
           
            
            foreach (var v in list)
            {
                Response.Write(v.TASK_ID+"</br>");
            }
    
            Response.Write(recordCount);
     
           
        }
    }
  • 相关阅读:
    增加工作日排序字段
    HIVE分析函数
    hive取等分数据
    HIVE锁相关
    shell脚本启动java程序
    Jetbrain ide Avaliable servers
    SPARK调优
    SQL 十分位
    HDFS配额查询
    jQuery 选择器
  • 原文地址:https://www.cnblogs.com/tiancai/p/4788911.html
Copyright © 2020-2023  润新知