Linq query to match the data and update a particular column

Hi All

I am not so good with Linq query. Can you pls advise any Linq query?


Hi @taruna.mehra ,

It would be easy for us to understand your requirement if you can perhaps provide the input and expected output.



Can you please explain a little more and may I know why do you need only linq?

Please check this post about no speed difference with using linq or loop


Hi All thanks

I have 2 columns which ever is matching I need to update one more columns based on that as NIL. Matching columns will have unique value and matching data. It has to be picked from 2 data tables

@taruna.mehra , refer the following thread, the use case is same:


You can try Chatgpt for some complex linq query if you want.

1 Like

Hi @taruna.mehra
As per my understand u have Two Datatables like
DT1 with Column_A ,Column_B .
DT2 with Master_A



If Column_A is matched with Master_A,then update as “Nil” in DT1 Column_B
if not matched i will mention “NA”

u can use this expression

dt1=(From row In dt1.AsEnumerable()
Let A=row("Column_A")
Let B=If(dt2.AsEnumerable().Any(Function(r) r("Master_A").ToString = row("Column_A").ToString), "NIL", "NA")
Select dt1.Clone.Rows.Add(A,B)).CopyToDataTable()

Find the Xaml (1.8 MB)

**Note:**Based on your condition the query will change

It will be help full if we get Share Screen shot for Input and what kind of Output you want to derive in query.


Thanks I will try and will surely update you. Pls guide me further if it doesn’t work

Hi, I want where it is matched and status column is empty otherwise this column has certain data. Where this column doesnt have data and it is matching, it should set status NIL.

Test.xlsx (8.5 KB)
if you see this chart, suppose 2 columns data is matched there we are already updating status with certain data but sometimes when bot missed and there we need to update the this status column as Nil where it is blank.