I want to make two data tables into one data table.
for example
A data table is
“C1” “C2”
2 5
And
B data table is
“C3” “C4”
3 5
It’s like this, put together,
In a data table called D
“C1” “C2” “C3” “C4”
2 5 3 5
I want to make it like this. The columns are “C1” “C2” “C3” "C4
If there is a good Linq or method, please let me know.
mkankatala
(Mahesh Kankatala)
2
Hi @kim0034kkq
You can use the Merge datatable activity to merge the two datatable into one.
Hope it helps!!
mkankatala
(Mahesh Kankatala)
3
Hello @kim0034kkq
If you want to use the LINQ Expression, Let’s take column names as you suggested, check the below expression,
- Assign -> mergedDt = (From row1 In dt1.AsEnumerable()
Join row2 In dt2.AsEnumerable()
On dt1.Rows.IndexOf(row1) Equals dt2.Rows.IndexOf(row2)
Select mergedDt.LoadDataRow(New Object() {row1("C1"), row1("C2"), row2("C3"), row2("C4")}, False)).CopyToDataTable()
Hope it helps!!
Hello @kim0034kkq Please check this post this is the solution to merge the two data tables,
@kim0034kkq
check the thread as reference