zoukankan      html  css  js  c++  java
  • DataTable拆分分页

     public DataTable GetPagedTable(DataTable dt, int PageIndex, int PageSize)
            {
                if (PageIndex == 0)
                {
                    return dt;
                }
                DataTable newdt = dt.Copy();
                newdt.Clear();
                int rowbegin = (PageIndex - 1) * PageSize;
                int rowend = PageIndex * PageSize;
                if (rowbegin >= dt.Rows.Count)
                {
                    return newdt;
                }

                if (rowend > dt.Rows.Count)
                {
                    rowend = dt.Rows.Count;
                }

                for (int i = rowbegin; i < rowend - 1; i++)
                {
                    DataRow newdr = newdt.NewRow();
                    DataRow dr = dt.Rows[i];
                    foreach (DataColumn column in dt.Columns)
                    {
                        newdr[column.ColumnName] = dr[column.ColumnName];
                    }
                   
                }
                return newdt;
            }

  • 相关阅读:
    python3 socketserver服务端
    python3 组合的用法
    python3 面向对象高级一些的
    python3 继承原理
    python3 对象之间的交互
    hadoop配置、运行错误总结
    Hadoop配置项整理(mapred-site.xml)
    Hadoop配置项整理(core-site.xml)
    Hadoop配置项整理(hdfs-site.xml)
    Linux Shell 按Tab键不能补全
  • 原文地址:https://www.cnblogs.com/aweifly/p/2741593.html
Copyright © 2011-2022 走看看