For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > May 2004 > ADOX and VB.NET









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ADOX and VB.NET
Randy

2004-04-27, 12:09 am

I am trying to relink some Oracle tables in MS Access via ADOX and VB.NET.

My code:
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim OracleConn As String = "Provider=MSDAORA.1;Data Source=xyz;User ID=xyz;Password=xyz

cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\databases\xyz\xyz.mdb;Jet OLEDB:Engine Type=5"
tbl.ParentCatalog = cat
For Each tbl In cat.Tables
'Check to make sure the table is a linked table
If tbl.Type = "LINK" Then
tbl.Properties("Jet OLEDB:Create Link") = True
tbl.Properties("Jet OLEDB:Link Provider String") = OracleConn
tbl.Properties("Jet OLEDB:Cache Link Name/Password") = True
End If
Next

The three tbl.Properties() lines are given me an error in the IDE saying that tbl.Properties is Read-Only. I've been able to get this to work in VB6 in the past but don't understand what is happening in VB.NET 2003. Any ideas?

Thanks

Randy


Ken Halter

2004-04-27, 12:09 am

Randy wrote:
> I am trying to relink some Oracle tables in MS Access via ADOX and VB.NET.


Sorry... wrong group. .Net groups all contain the word "dotnet" or
"vsnet" in their names.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Randy

2004-04-27, 12:09 am

Thanks, specifying .Value solved the problem.
Paul Clement

2004-05-04, 11:45 am

On Mon, 26 Apr 2004 11:06:01 -0700, "Randy" <anonymous@discussions.microsoft.com> wrote:

¤ I am trying to relink some Oracle tables in MS Access via ADOX and VB.NET.
¤
¤ My code:
¤ Dim cat As New ADOX.Catalog
¤ Dim tbl As New ADOX.Table
¤ Dim OracleConn As String = "Provider=MSDAORA.1;Data Source=xyz;User ID=xyz;Password=xyz
¤
¤ cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\databases\xyz\xyz.mdb;Jet OLEDB:Engine Type=5"
¤ tbl.ParentCatalog = cat
¤ For Each tbl In cat.Tables
¤ 'Check to make sure the table is a linked table
¤ If tbl.Type = "LINK" Then
¤ tbl.Properties("Jet OLEDB:Create Link") = True
¤ tbl.Properties("Jet OLEDB:Link Provider String") = OracleConn
¤ tbl.Properties("Jet OLEDB:Cache Link Name/Password") = True
¤ End If
¤ Next
¤

I don't believe the interop assembly for ADOX accounts for the default property Value. It must be
specified:

tbl.Properties("Jet OLEDB:Create Link").Value = True
tbl.Properties("Jet OLEDB:Link Provider String").Value = OracleConn
tbl.Properties("Jet OLEDB:Cache Link Name/Password").Value = True


Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com