473,382 Members | 1,648 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,382 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 5498
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...
1
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.