esak2000
asked on
C# Left join 2 DataTables without knowing the content of each, just the join key
I have 2 C# DataTables that I want to left join in order to create a combined DataTable.
I know the name of the column that joins the table, but nothing else, as the use imports the 2 tables at startup. The joining column is 'UPC'
1. What is a code example to join the 2 tables together to a third DataTable with all columns?
2. If there are column with the same name in each table will it be a problem for the join? If so, is there any solution?
I know the name of the column that joins the table, but nothing else, as the use imports the 2 tables at startup. The joining column is 'UPC'
1. What is a code example to join the 2 tables together to a third DataTable with all columns?
2. If there are column with the same name in each table will it be a problem for the join? If so, is there any solution?
>>If there are column with the same name in each table will it be a problem for the join?
NO, but you need to refer to them with the table names eg.
T1.x or T2.x (so you know which field called x is coming from which table)
NO, but you need to refer to them with the table names eg.
T1.x or T2.x (so you know which field called x is coming from which table)
ASKER
that's a standard sql query, I need the LINQ equivalent for .net datatables
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This class worked as a solution worked to join the 2 datatables
where T1 and T2 are the table names you have