Two columns in two data tables are equal then bringing one column value to one data table using LINQ

Hi everyone,

I want to do the below process using LINQ as the number of rows are high(around one lakh in each data table).

Note: I can not use join method because i want to compare using contains method which will not be in JOIN method.

I have two data tables(row count of each data table will be 1 lakh or more). What i have to do is i have to compare same column values in two data tables using contains method if they are equal then i have to bring column value to one of these data tables if they are not equal then i don’t want to do anything.

Please help it is urgent requirement.

Regards,
Roman reigns.

@User_98

you can try with invoke code activity

Dim counter As Int32
For Each row In dt1.AsEnumerable
	If row("ColumnName").ToString.trim.Contains(dt2.Rows(counter).Item("ColumnName").ToString) Then
		row("ColumnName")=dt2.rows(counter).item("ColumnName")
		Else
			row("ColumnName")=row("ColumnName").ToString
		End If
	counter=counter+1	
Next
		

in place of columnName pass your columnName

Thank you @Shiva_Nikhil for the fast reply.

I will check this and let you know.

Regards,
Roman reigns.

1 Like

Hi,
check this approach.
as you have Lacks of data better to use parallel for each

source: dt1.AsEnumerable.Select(function(x) x).ToList

condition: dt2.AsEnumerable().Any(function(x) x(“ColumnName”).ToString.Contains(dt1_row(“ColumnName”).ToString))

Fetch value: dt2.AsEnumerable().FirstOrDefault(function(x) x(“ColumnName”).ToString.Contains(dt1_row(“ColumnName”).ToString))