473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using ADOX to update a Property does not work.

Using ADOX to update a Property does not work.

I want to change the Access database for a linked table. My abridged code is:

Dim oCAT As ADOX.Catalog
oCAT = New ADOX.Catalog
oCAT.ActiveConnection = goConnection
Dim t As ADOX.Table
Dim p As ADOX.Property

For Each t In oCAT.Tables
If t.Type = "LINK" Then
t.Properties("Jet OLEDB:Link Datasource") = "C:\MyAccess.mdb"
End If
Next t

When I write the code in Access 2003, it works fine. When I write this code
in VB.NET, I get an error message for this line: 't.Properties(.....) =
"....."'
that says "Property Item is read-only". The line does not compile.

How can I change this property for a linked table from VB.NET??
Nov 21 '05 #1
2 5493
On Sun, 6 Mar 2005 03:39:02 -0800, "genojoe" <ge*****@discussions.microsoft.com> wrote:

¤ Using ADOX to update a Property does not work.
¤
¤ I want to change the Access database for a linked table. My abridged code is:
¤
¤ Dim oCAT As ADOX.Catalog
¤ oCAT = New ADOX.Catalog
¤ oCAT.ActiveConnection = goConnection
¤ Dim t As ADOX.Table
¤ Dim p As ADOX.Property
¤
¤ For Each t In oCAT.Tables
¤ If t.Type = "LINK" Then
¤ t.Properties("Jet OLEDB:Link Datasource") = "C:\MyAccess.mdb"
¤ End If
¤ Next t
¤
¤ When I write the code in Access 2003, it works fine. When I write this code
¤ in VB.NET, I get an error message for this line: 't.Properties(.....) =
¤ "....."'
¤ that says "Property Item is read-only". The line does not compile.
¤
¤ How can I change this property for a linked table from VB.NET??

You need to specify the Value property:

t.Properties("Jet OLEDB:Link Datasource").Value = "C:\MyAccess.mdb"
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #2
It does work. My line of code needs to be:

t.Properties("Jet OLEDB:Link Datasource").Value = "C:\MyAccess.mdb"

With this change it worked fine.
"Paul Clement" wrote:
On Sun, 6 Mar 2005 03:39:02 -0800, "genojoe" <ge*****@discussions.microsoft.com> wrote:

¤ Using ADOX to update a Property does not work.
¤
¤ I want to change the Access database for a linked table. My abridged code is:
¤
¤ Dim oCAT As ADOX.Catalog
¤ oCAT = New ADOX.Catalog
¤ oCAT.ActiveConnection = goConnection
¤ Dim t As ADOX.Table
¤ Dim p As ADOX.Property
¤
¤ For Each t In oCAT.Tables
¤ If t.Type = "LINK" Then
¤ t.Properties("Jet OLEDB:Link Datasource") = "C:\MyAccess.mdb"
¤ End If
¤ Next t
¤
¤ When I write the code in Access 2003, it works fine. When I write this code
¤ in VB.NET, I get an error message for this line: 't.Properties(.....) =
¤ "....."'
¤ that says "Property Item is read-only". The line does not compile.
¤
¤ How can I change this property for a linked table from VB.NET??

You need to specify the Value property:

t.Properties("Jet OLEDB:Link Datasource").Value = "C:\MyAccess.mdb"
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Developer98115 | last post by:
I need help getting schema information from an existing SQL Server database. My thought was that you could use ADOX via InterOp. Has anyone done this successfully and how? I have created a...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
6
by: Claudia Fong | last post by:
Hello, I'm using the sql statement below to create a new table from an old one. But I found a little problem with that. In my old table DEP2004, I have one field's property allow zero length...
2
by: Tim Frawley | last post by:
I am attempting to change the ODBC Link Provider String in an Access database linked to an Oracle server using ADOX in VB.NET. I created some code using the example from post:...
3
by: gaffar | last post by:
Sir, Using ADOX I am developing an application in vb.net and the backend database is ms-access. i have created ms-access databse and tables and assigned primary keys to the tables through the...
1
by: Gaffar | last post by:
Hello Sir, i have created ms access database file by using ADOX. in which i have created 4 tables. 1 master table and 3 child tables. in the master table i have assigned primary key and in the...
1
by: sunlight_sg | last post by:
Hello, i am using ADOX + VB .NET to create a Access Database programmatically. I plan to set some properties of the column such primary key. The code is as follows: Dim cat As ADOX.Catalog...
1
by: Hexman | last post by:
I'm creating a new Access table using ADOX. I can add columns and indexes, but I'm baffled on how to change field properties. Can someone give me a hand? Want to change properties such as:...
4
by: Frank Rizzo | last post by:
I am using ADOX to make changes to an Access database that would be difficult to do via the System.Data.OLEDBClient. So far I have no trouble actually doing the work, however, I have trouble...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.