码迷,mamicode.com
首页 > Windows程序 > 详细

c# datarow[] 转换成 datatable

时间:2016-08-29 10:20:45      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:

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;
}

c# datarow[] 转换成 datatable

标签:

原文地址:http://www.cnblogs.com/xwchengc/p/5816935.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!