By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Create Linked table in Access

P: n/a
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.Connection
Dim Cat As New ADOX.Catalog
Dim tbl As New ADOX.Table

Con.Open(m_sAccessDbPath)
Cat.ActiveConnection = Con

' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
tbl.Name = m_sAccessDbTableName
tbl.ParentCatalog = 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.Append(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

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Well, it COULD be because the line(s) don't expliccitly specify the property
you wish to set (remember VB.NET doesn't have the concept of default
properties).

Try something like this:
tbl.Properties("Jet OLEDB:Create Link").Value = True

so that you are explictly saying you want to set the value of that item in
the Properties collection.

And I'm making a (reasonable) guess that you need the word "Value" - it
could be something else...

al*****@yahoo.com

"Kent" wrote:
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.Connection
Dim Cat As New ADOX.Catalog
Dim tbl As New ADOX.Table

Con.Open(m_sAccessDbPath)
Cat.ActiveConnection = Con

' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
tbl.Name = m_sAccessDbTableName
tbl.ParentCatalog = 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.Append(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

Nov 21 '05 #2

P: n/a
That did it, None of the MS examles show this.
Thanks.

"alaspin" wrote:
Well, it COULD be because the line(s) don't expliccitly specify the property
you wish to set (remember VB.NET doesn't have the concept of default
properties).

Try something like this:
tbl.Properties("Jet OLEDB:Create Link").Value = True

so that you are explictly saying you want to set the value of that item in
the Properties collection.

And I'm making a (reasonable) guess that you need the word "Value" - it
could be something else...

al*****@yahoo.com

"Kent" wrote:
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.Connection
Dim Cat As New ADOX.Catalog
Dim tbl As New ADOX.Table

Con.Open(m_sAccessDbPath)
Cat.ActiveConnection = Con

' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
tbl.Name = m_sAccessDbTableName
tbl.ParentCatalog = 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.Append(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

Nov 21 '05 #3

P: n/a
SCM
Anyone has VC++ sample code on this topic
--
Regards,
SCM
Programmer
"Kent" wrote:
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.Connection
Dim Cat As New ADOX.Catalog
Dim tbl As New ADOX.Table

Con.Open(m_sAccessDbPath)
Cat.ActiveConnection = Con

' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
tbl.Name = m_sAccessDbTableName
tbl.ParentCatalog = 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.Append(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

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.