I want to Update the datatable which having duplicate rows and update the Value in Datatable

I have two data tables dt1 and dt2 in dt1 has one line with Columns(PO Number, Quantity, Material, Final Value) and dt2 has (SL.No, PO Number, Quantity, Material, Final Value) 2 lines but the same values whereas in two dts then I want to delete the one line item in the Dt2 and Update the value in FInal Value column if it same can you give linq query for this scenario


Dt1

Dt2

@Melbin_Antu

Try the below

First use assign with below

Dt2 = Dt2.AsEnumerable.GroupBy(function(x) x("PO Number").ToString + x("Quantity").ToString + x("Material").ToString).Select(function(x) x.First).CopyToDataTable

Then use the below in invoke code to update data send dt2 as in/out and dt1 as in

Dt2.AsEnumerable.ToList.ForEach(Sub(x) x("Final Value") = dt1.AsEnumerable.Where(function(y) y("PO Number").ToString.Equals(x("PO Number").ToString)).First()("Final Value").ToString)

Note: Edited to fit requirement and fixed issues

Cheers


its not working

i want to match the PO Number,Material,Quantity with two Dts then I want to update the final value in Dt2 before that I want to delete the duplicate line with same values

@Melbin_Antu

Please check the edited query above

cheers


these is the error is facing

@Melbin_Antu

Can you show the error from locals panel please

also in your data every row in dt2 will have a row in dt1?

cheers