DataRow 数组转化成DataTable

#region 封装DataTable

DataTable dt = null;
if (newRows.Length > 0)
{
dt = newRows[0].Table.Clone(); // 复制DataRow的表结构
foreach (DataRow row in rows)
{
dt.Rows.Add(row.ItemArray); // 将DataRow添加到DataTable中
}
}

#endregion

你可能感兴趣的:(Datatable)