更新时间:2023-12-01 10:57:22
Hi Athar
欢迎来到MSDN论坛!
关于如何比较两个DataTable,请按
参考下面的代码:
public static DataTable CompareTwoDataTable(DataTable dt1,DataTable dt2)
{
dt1.Merge(dt2);
DataTable d3 = dt2.GetChanges();
return d3;
}
Hi
I have 2 tables dt1 and dt2.
DataTable dt1= query1.CopyToDataTable(); DataTable dt2= query2.CopyToDataTable(); // Find the except of the two tables. var contacts = dt1.AsEnumerable().Except(dt2.AsEnumerable(), DataRowComparer.Default);Hi Athar
Welcome to the MSDN forum!
About how to compare two DataTable, please refer to the code as below:
public static DataTable CompareTwoDataTable(DataTable dt1, DataTable dt2) { dt1.Merge(dt2); DataTable d3 = dt2.GetChanges(); return d3; }