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();

  • 相关阅读:
    linux下使用tar命令
    ContentType和@ResponseBody
    ActiveMQ两种模式PTP和PUB/SUB<转>
    Postgresql分表与优化
    PostgreSQL存储过程<转>
    PostgreSQL Table Partitioning<转>
    Postgresql查询表的大小
    Postgresql添加/删除触发器示例
    Android TextView 支持的HTML标签
    我只是一直很努力
  • 原文地址:https://www.cnblogs.com/ajun/p/2814511.html
Copyright © 2011-2022 走看看