Hi everyone, could you help me with something? I have two tables, dt_SAP and dt_BaseDrive. Dt_SAP has the pending order records and dt_BaseDrive has the entire order history. Dt_BaseDrive has a column called Status, and both tables have a column called Document. The condition is that if the data in the Document column of dt_BaseDrive is not in the Document column of dt_SAP, the status should change to Delivered in dt_BaseDrive. How can I do this with Linq?
Can you try the below code

For Each rowBaseDrive As DataRow In dt_BaseDrive.Rows
Dim documentExists As Boolean = dt_SAP.AsEnumerable().Any(Function(sapRow) sapRow("Document").ToString() = rowBaseDrive("Document").ToString())
If Not documentExists Then
rowBaseDrive("Status") = "Delivered"
End If
Next
Regards,
Perfect! Thank you very much for your help.
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
