I am new to VB.NET and am trying to merge two datasets into one by looping through the first using a for Each loop and the second table using a For loop then I use an if, which doesn't currently work, to compare the UserID in each table, in the Address table the UserID is not always unique so I can't use a parent child relation to do this join. I unfortunately cannot do this join in the database so I have to do a merge in .net. Any help on how best merge these two tables would be greatly appreciated.
For Each drSuppData In dsData.Tables("Addresses").Rows
For i = 0 To dsData.Tables("Users").Rows.Count - 1
TmpUserID = CType(dsData.Tables("Users").Rows(i).Item("UserID"), String)
If TmpUserID = (drSuppData.Item("UserID") Then
dsData.Tables("Users").Rows(i).Item("Address") = drSuppData.Item("Address")