Hi devs, I have 2 datatables dt1 and dt2, I want to check if condition serialNumber in dt1 equals serialNumber in dt2 if true, update the row(“email”) from dt2 with row(“email”) from dt1. Pls assist.Regards
do you have excel sample to upload?
Maybe something like this would do:
Dim serialNumber As String Dim matchingRowsDt2() As DataRow For Each rowDt1 As DataRow In dt1.Rows serialNumber = rowDt1("serialNumber").ToString.Trim.ToUpper matchingRowsDt2 = dt2.AsEnumerable.Where(Function(r) r("serialNumber").ToString.Trim.ToUpper.Equals(serialNumber)).ToArray If (matchingRowsDt2.Length > 0) Then For Each rowDt2 As DataRow In matchingRowsDt2 rowDt2("email") = rowDt1("email").ToString Next End If Next
You can 2 Datatable variable. The do the below step.
1)use For Each row in DataTable Activity and loop through each row of the DT1.
2)use filter on the DT2 using the currentRow(0).ToString. (which is the first row data from DT1).
3)iF data is present use Write Cell(DT2 Email id) and update the values with DT1 email id.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.