Two structure-like DataTable merging
- DataTable DataTable1 = new DataTable ();
- DataTable DataTable2 = new DataTable ();
- DataTable newdatatable = Datatable1.clone ();
- object[] obj = new Object[newdatatable.columns.count];
- for (int i = 0; i < DataTable1.Rows.Count; i++)
- {
- Datatable1.rows[i]. Itemarray.copyto (obj,0);
- NEWDATATABLE.ROWS.ADD (obj);
- }
- for (int i = 0; i < DataTable2.Rows.Count; i++)
- {
- Datatable2.rows[i]. Itemarray.copyto (obj,0);
- NEWDATATABLE.ROWS.ADD (obj);
- }
- Or
- DataTable DataTable1 = new DataTable ();
- DataTable DataTable2 = new DataTable ();
- object[] obj = new Object[datatable1. Columns.count];
- for (int i = 0; i < DataTable2.Rows.Count; i++)
- {
- Datatable2.rows[i]. Itemarray.copyto (obj,0);
- DATATABLE1.ROWS.ADD (obj);
- }
- DataTable DataTable1 = new DataTable ();
- DataTable DataTable2 = new DataTable ();
- DataTable newdatatable = Datatable1.clone ();
- object[] obj = new Object[newdatatable.columns.count];
- for (int i = 0; i < DataTable1.Rows.Count; i++)
- {
- Datatable1.rows[i]. Itemarray.copyto (obj,0);
- NEWDATATABLE.ROWS.ADD (obj);
- }
- for (int i = 0; i < DataTable2.Rows.Count; i++)
- {
- Datatable2.rows[i]. Itemarray.copyto (obj,0);
- NEWDATATABLE.ROWS.ADD (obj);
- }
- Or
- DataTable DataTable1 = new DataTable ();
- DataTable DataTable2 = new DataTable ();
- object[] obj = new Object[datatable1. Columns.count];
- for (int i = 0; i < DataTable2.Rows.Count; i++)
- {
- Datatable2.rows[i]. Itemarray.copyto (obj,0);
- DATATABLE1.ROWS.ADD (obj);
- }