CSkin博客
标题: 合并datatable时因为有空的表,就出现了目标数组的长度不够 [打印本页]
作者: qxdszm 时间: 2016-11-18 14:43
标题: 合并datatable时因为有空的表,就出现了目标数组的长度不够
DataTable newtable = GZBH1.Clone();
int Count = newtable.Rows.Count;
object[] obj = new object[newtable.Columns.Count];
for (int j = 0; j < GZBH1.Rows.Count; j++)
{
GZBH1.Rows[j].ItemArray.CopyTo(obj, 0);
newtable.Rows.Add(obj);
}
for (int j = 0; j < GZBH2.Rows.Count; j++)
{
GZBH2.Rows[j].ItemArray.CopyTo(obj, 0);
newtable.Rows.Add(obj);
}
for (int j = 0; j < GZBH3.Rows.Count; j++)
{
GZBH3.Rows[j].ItemArray.CopyTo(obj, 0);
newtable.Rows.Add(obj);
}
欢迎光临 CSkin博客 (http://bbs.cskin.net/) |
Powered by Discuz! X3.2 |