zoukankan      html  css  js  c++  java
  • Linq to sql 分页

       在读取的数据集进行跳跃查询,关键方法Skip().Take(); 

       Skip跳过序列中指定的元素

       Take从序列的开头返回指定数量的连续元素

        var select = from n in entities.lib_reportinfo
                         join e in entities.lib_enterprise on n.Ep_Guid equals e.Guid into temp_ne
                         from tt in temp_ne.DefaultIfEmpty()
                         select new
                         {
                             guid = n.Guid,
                             epName = tt.Ep_Name,
                             epTrade = tt.Ep_Trade,
                             riName = n.Ri_ReportName,
                             riTime = n.Ri_PubTime,
                             riNd = n.Ri_ReportYear,
                             riCreateTime = n.CreateTime,
                             riPath = n.Ri_ReportPath
                         };
            pagecount.Text = select.ToList().Count.ToString();
            var query = select.OrderByDescending(r => r.riCreateTime).Skip(pagesize * (pageindex - 1)).Take(pagesize);       
            ListView1.DataSource = query;
            ListView1.DataBind();

  • 相关阅读:
    asp.net 对母版页的控件事件
    treeview操作集合
    使用GAppProxy时安全证书无效的解决办法
    向Excel模板中添加数据
    C# 重写 winform 关闭按钮
    完整ASP.Net Excel导入程序(支持2007)
    随笔二则
    标记枚举(flags)的使用
    System.Reflection.Missing.Value与Type.Missing
    Windows下Android源码下载方法
  • 原文地址:https://www.cnblogs.com/ajun/p/2814511.html
Copyright © 2011-2022 走看看