On using Linq query on 2 datatables

Hi everyone,
I need help on below scenario
I have 2 datatables , in 1 datatable we are having appox 64 columns (it may differ as well) ,
added 1 new column called " status"
Now i have to use vlookup using linq query between 2 datatables based on 1 column and i have to update the status column value from dt2 to dt1.

Please help
Thanks in advance

@Suma1993

dt1 (In/Out Argument)
dt2 (In Argument)

Dim query = From row1 In dt1.AsEnumerable()
            Join row2 In dt2.AsEnumerable()
            On row1("CommonColumn").ToString() Equals row2("CommonColumn").ToString()
            Select row1, row2

For Each pair In query
    pair.row1("status") = pair.row2("status").ToString()
Next

Put this in invoke code

This is the sample code as per your requirement

Hi @Suma1993

Share your input data and expected output for our understanding. If your data is confidential then share the dummy data with us.

Hi @Suma1993

Check the below thread

Regards,

Sure @mkankatala , please find sample excel consists of 2 sheets considered as 2 data tables, Sheet1 is the base and expected output highlighted in sheet1.

Sample_1.xlsx (9.4 KB)

Thank You so much @rlgandu , It works perfectly

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.