I have two datatables and want to merge all columns into third one. It will be awesome if it is possible with LINQ.
Try with this one and let me know , Thanks
dataTable1.AsEnumerable().Union(dataTable2.AsEnumerable()).CopyToDataTable()
It is returning columns from dt_One only and don’t have headers.
Use either Merge Data Table or Join Data Table. Depends on your needs but you didn’t give any detail so we can’t tell what you’re trying to do.
It requires at least one argument to join on.
I want have all columns with headers in third table. So each table has 6 columns minimum and want all of them in third.
That’s not detail. Show us the data and show us what you want the result to look like. Do the two datatables have a common value you’re trying to match on, etc?
Yes both of them have a column named ‘Code’. If code is same, need to put that row in third datatable. But it gives the only two columns that I am matching. Rest of columns aren’t getting into third table.
Then join on code column
And if you want all rows from both tables then use outer or full join
Columsn from both tables will flow into joined table
Cheers
These are two different datatables. I want rows in third table if code match. And rest of columns too with their name.
Use the Join Data Table activity, set it to left join. Set the conditions to “Code” equals “Code”
Please give a try to join both of the tables based on code , it will give you what you expect .
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.