System.Data.DataRow[] 如何转换为 DataTable
作者:互联网
private DataTable ToDataTable(DataRow[] rows)
{
if (rows == null || rows.Length == 0) return null;
DataTable tmp = rows[0].Table.Clone(); // 复制DataRow的表结构
foreach (DataRow row in rows)
{
tmp.ImportRow(row); // 将DataRow添加到DataTable中
}
return tmp;
}
标签:tmp,rows,System,DataRow,null,Data,DataTable,row 来源: https://www.cnblogs.com/ning-xiaowo/p/14110620.html