I am trying to create a VB.NET Windows application to move some data from a
local Access DB table to a table in a SQL Server. The approach I am trying
is to open an OLEDB connection to the local Access DB and then add a Linked
Table pointing to the table on the SQL Server and then run an "Insert Into
(linked table)" query to add the new rows.
I am having a problem getting the syntax to add that linked table to my
local Access DB. When I used to create a LinkedTable to another Access DB I
used to use the code below but I haven't been able to find the correct
syntax to make linked table from SQL Server.
Pointers to any helpful information will be much appreciated.
Wayne
============== Code =================
Public Sub AddLink()
Dim objCat As ADOX.Catalog
Dim objTbl As ADOX.Table
objCat = New ADOX.Catalog
objTbl = New ADOX.Table
objCat.ActiveConnection = myConn
objTbl.Name = "DC"
objTbl.ParentCatalog = objCat
objTbl.Properties("Jet OLEDB:Create Link") = True
objTbl.Properties("Jet OLEDB:Link Provider String") = "MS
Access;DATABASE=" & strLocalDBPath
objTbl.Properties("Jet OLEDB:Remote Table Name") = "DC"
objCat.Tables.Append(objTbl)
objCat.Tables.Refresh()
objCat = Nothing
objTbl = Nothing
End Sub
========================================