Linq in Data Tables

Hi,
I need to join two tables using linq,

Dim vLINQ = (From DT1 In vDT1.AsEnumerable
            Join DT2 In vDT2.AsEnumerable
            On DT1.Field(Of String)("Key") Equals DT2.Field(Of String)("Key")
            Select new with
            {
               .Key = DT1.Field(Of String)("Key"), 
               .Data1 = DT1.Field(Of String)("Data1"), 
               .Data2 = DT1.Field(Of String)("Data2"),
               .Data3 = DT2.Field(Of String)("Data3"), 
               .Data4 = DT2.Field(Of String)("Data4")
            }).ToList()

I used assign activity to achive this. UIPath showing error as

Option Strict On disallows late binding.

how I can Use this type of LINQ in UIPath?

3 Likes

Did you find any answer for this.?

Hi @Divyashreem,
@ddrdushy1
Refer this Post Join Two Data table

Regards,
Arivu

2 Likes

i need to join 3 tables here, and i had written linq query but it is throwing an error

i got the solution thank you

Hi Divya,
Can you share the solution

Linq didnt, work for me as well, i used simple 3 for loops one inside the other.

Hi Divya,
Can you post the solution.

i have used For loop inside another for loop that’s all.

Using Linq is possible for joining 3 data table. Please find the below sample query.

(from a in Company1 join b in Company2 on a (“EMPId”).Tostring() equals b (“EMPId”).Tostring() join c in Company3 on c.(“EMPId”).Tostring() equals b.(“EMPId”).Tostring()) select a)

2 Likes

Hi,

I have two datatables with huge volume of data around 2 Lakhs (Min) in datatable 2 and around 1 lakh data in datatable 1. I need to compare three columns in two datatables , if all the values in two datatable matches, (account) column value from datatable 2 needs to be updated in the account column in datatable 1.Since the query is wrote is taking too much time. Help me to find a solution for this.

Regards,
Niranjanaa

Hi @Devendhar_Rao_Gadde

This has worked for 3 data tables. Its taking out the common unique column data.

Anyone who wants to work with 3 data table can follow the same LINQ query.

Regards,
Rushikesh

Hello, I tried this code but it threw several errors. The there are periods between letters (b.("EMPId) in two cases but not others. Also, there seems to be an extra “)” after the last Tostring()). Wanted this to work but haven’t figured out what is the issue