Merge two DataTable in .Net
Recently I had a need to merge two DataTables with same structure, DataSet has built-in function called Merge but not in DataTable.
So I wrote my own, this is my function to merge two DataTables…
public static DataTable mergeDTs(DataTable dt1, DataTable dt2)
DataTable dtResult = dt1.Clone();
foreach (DataRow dr in dt1.Rows)
foreach (DataRow dr in dt2.Rows)
Hope this helps.