I am try to link a SQL 2000 table to Access 2000 using VB.Net 2003
Here is my code:
Dim Con As New ADODB.Connectio n
Dim Cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Con.Open(m_sAcc essDbPath)
Cat.ActiveConne ction = Con
' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
tbl.Name = m_sAccessDbTabl eName
tbl.ParentCatal og = Cat
' Set the properties to create the link.
tbl.Properties( "Jet OLEDB:Create Link") = True
tbl.Properties( "Jet OLEDB:Link Provider String") = RemoteDbPath
tbl.Properties( "Jet OLEDB:Remote Table Name") = RemoteTableName
' Append the table to the Tables collection.
Cat.Tables.Appe nd(tbl)
The problem is, I have 3 build errors:
Property 'Item' is 'ReadOnly'.
On:
tbl.Properties( "Jet OLEDB:Create Link") = True
tbl.Properties( "Jet OLEDB:Link Provider String") = RemoteDbPath
tbl.Properties( "Jet OLEDB:Remote Table Name") = RemoteTableName
The ADOX I am useing is:
Microsoft ADO Ext. 2.7 for DDL and Security
What am I doing wrong?
Thanks for you help
Here is my code:
Dim Con As New ADODB.Connectio n
Dim Cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Con.Open(m_sAcc essDbPath)
Cat.ActiveConne ction = Con
' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
tbl.Name = m_sAccessDbTabl eName
tbl.ParentCatal og = Cat
' Set the properties to create the link.
tbl.Properties( "Jet OLEDB:Create Link") = True
tbl.Properties( "Jet OLEDB:Link Provider String") = RemoteDbPath
tbl.Properties( "Jet OLEDB:Remote Table Name") = RemoteTableName
' Append the table to the Tables collection.
Cat.Tables.Appe nd(tbl)
The problem is, I have 3 build errors:
Property 'Item' is 'ReadOnly'.
On:
tbl.Properties( "Jet OLEDB:Create Link") = True
tbl.Properties( "Jet OLEDB:Link Provider String") = RemoteDbPath
tbl.Properties( "Jet OLEDB:Remote Table Name") = RemoteTableName
The ADOX I am useing is:
Microsoft ADO Ext. 2.7 for DDL and Security
What am I doing wrong?
Thanks for you help
Comment