帮忙看下dataTable分页的问题
int count = dTable.Rows.Count;//一页里面只能有十行数据
int pages = count / 10 + 1;
DataTable dataTable = new DataTable[pages];
int num = 0;
for (int i = 0; i < pages; i++)
{
dataTable[i] = dTable.Copy();
dataTable[i].Clear();
for (int j = 0; j < 10; i++)
{
if (num < count)
{
object[] obj = dTable.Rows[num].ItemArray;
//这里必须是ItemArray才行
dataTable[i].Rows.Add(obj);
num++;
}
}
}
为什么会出现问题呢dataTable[i].Rows.Add(obj);这里会龊索引超出范围