Join DataTable
public static DataTable JoinDataTable(DataTable oDataTable1, DataTable oDataTable2) { if (oDataTable1 == null || oDataTable2 == null) return null; DataTable odtt = oDataTable1.Copy(); foreach (DataRow row in oDataTable2.Rows) { try { DataRow r = odtt.NewRow(); r.ItemArray = row.ItemArray; odtt.Rows.Add(r); } catch (Exception e) //if the schema are not equal { string x = e.Message; break; } } return odtt; } |
Sign up to our newsletter
Receive our latest updates about programming languages, software, database, books, ebooks, classes, jobs and more.