Help with retreiving multiple countries to copy to another table
Posted on 2011-02-14
I'm using the code below to retreive countries from COUNTRY column in AOP5 and copy it to Column CA2 in AOP6A, problem is I need to retreive multiple countries in the following format: BEL,CAN,FRA,USA and copy it to CA2 in AOP6A. Is there a way to retreive multiple countries for matching IDs between both table before I copy them to CA2?
For example to code below only retreives one country:
Set CA2='" & dTable.Rows(i).Item(1) & "'
I need to set CA2 = BEL,CAN,FRA etc..
Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\aopt2002org.mdb;Persist Security Info=True;Jet OLEDB:Database Password=testaopupdate"
Dim dbcon As New OleDbConnection(ConnectionString)
Dim dbcmd As New OleDbCommand
dbcmd.Connection = dbcon
dbcmd.CommandText = "Select SN, COUNTRY From AOP5"
Dim dTable As New DataTable
Dim dbadp As New OleDbDataAdapter(dbcmd)
For i As Integer = 0 To dTable.Rows.Count - 1
dbcmd.CommandText = "Update AOP6A Set CA2='" & dTable.Rows(i).Item(1) & "' Where SN='" & dTable.Rows(i).Item(0) & "'"
AOP6A Should include (AOP6A AND AOP5 are linked by the SN Field)