日期:2014-05-17 浏览次数:20400 次
protected DataTable MergeDataTable(DataTable dt1, DataTable dt2, string KeyColName,bool isMergeAll)
{
//合并列
DataTable ndt1 = dt1.Copy();
DataTable ndt2 = dt2.Copy();
ndt2.PrimaryKey = new DataColumn[] { ndt2.Columns[KeyColName] };
for (int i = 0; i < ndt2.Columns.Count; i++)
{
if (ndt2.Columns[i].ColumnName.ToLower().Trim() != KeyColName.ToLower().Trim())
{
ndt1.Columns.Add(ndt2.Columns[i].ColumnName);
}
}
&n