Add column to another table

Hello everyone,

I have 2 datatable (DT1, DT2). I want to add column DT2 to column DT1 but without looping.

Example:
DT1: A,B
DT2: C

Expected:
DT1: A,B,C

Anyone can help me?

Hi,

The following post will help you.

Regards,

Hi @Brian_Henokh1

Try this:

DT1 = (From row In DT1.AsEnumerable() From row2 In DT2.AsEnumerable() Select DT1.Clone.LoadDataRow({row("A"), row("B"), row2("C")}, False)).CopyToDataTable()

Hi @Brian_Henokh1

Check on this

Hope this helps!!

HI @Brian_Henokh1

Can you try with this expression

ResultDT = (From row1 In DT1.AsEnumerable()
           From row2 In DT2.AsEnumerable()
           Select DT1.Clone().LoadDataRow({row1("Column1"), row1("Column2"), row2("Column3")}, False)).CopyToDataTable()