473,771 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ActiveConn ection = goConnection
Dim t As ADOX.Table
Dim p As ADOX.Property

For Each t In oCAT.Tables
If t.Type = "LINK" Then
t.Properties("J et OLEDB:Link Datasource") = "C:\MyAccess.md b"
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 5523
On Sun, 6 Mar 2005 03:39:02 -0800, "genojoe" <ge*****@discus sions.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.ActiveConn ection = goConnection
¤ Dim t As ADOX.Table
¤ Dim p As ADOX.Property
¤
¤ For Each t In oCAT.Tables
¤ If t.Type = "LINK" Then
¤ t.Properties("J et OLEDB:Link Datasource") = "C:\MyAccess.md b"
¤ 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("J et OLEDB:Link Datasource").Va lue = "C:\MyAccess.md b"
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #2
It does work. My line of code needs to be:

t.Properties("J et OLEDB:Link Datasource").Va lue = "C:\MyAccess.md b"

With this change it worked fine.
"Paul Clement" wrote:
On Sun, 6 Mar 2005 03:39:02 -0800, "genojoe" <ge*****@discus sions.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.ActiveConn ection = goConnection
¤ Dim t As ADOX.Table
¤ Dim p As ADOX.Property
¤
¤ For Each t In oCAT.Tables
¤ If t.Type = "LINK" Then
¤ t.Properties("J et OLEDB:Link Datasource") = "C:\MyAccess.md b"
¤ 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("J et OLEDB:Link Datasource").Va lue = "C:\MyAccess.md b"
Paul ~~~ pc******@amerit ech.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
5568
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 Interop reference to the ADOX COM component from my C# project. I am able to open the SqlConnection successfully but it fails with an exception when I try to set the ..ActiveConnection property of the ADOX database catalog object. Another strange...
2
23941
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 but the table column names. I've seen other posts that suggest using the SQL command DESCRIBE but I can't get it to work for some reason. Other posts have code samples but they're written in VB which I am not familiar with. I
6
2704
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 is YES, but after creating the new table DEP2005, this property change to NO. It means it won't allow zero lenght.. How can I change this property in C#?
2
8658
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: http://groups.google.com/groups?q=RefreshLinkedTablesWithADOX()&hl=en&lr=&selm=qb1ctvcdoftenojhpp34lb6fjb9ss8qd9c%404ax.com&rnum=1 My code simply replaces the DSN, UID, PWD and DBQ values in the ADOXTable.Properties("Jet OLEDB:Link Provider String").Value string...
3
1713
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 vb.net application(code is below) by using ADOX. Now my problem is i want delete one record from master table, that deleted record automatically deleted from child tables. so, i want the code how to establish relation ships between the tables and...
1
1551
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 child tables i have assigned foreign key. now my problem is deleting a record in the master table can not be deleted if there exists a record in the child tables. so, to solve this problem i have to give the property update and delete cascade rule...
1
3459
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 Dim tbl As ADOX.Table Dim idx As ADOX.Index Dim prp As ADOX.Property
1
11597
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: Description (Column property?), Decimal Places, Caption, Default value, Required indicator, Format, etc.... TIA,
4
10745
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 closing the connection to the Access database. //open connection ADOX.CatalogClass connection = new ADOX.CatalogClass(); connection.let_ActiveConnection(this.ConnectionString); //do the work
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.