PDA

Click to See Complete Forum and Search --> : ODBC DSN List


Negative0
Jul 10th, 2000, 03:08 PM
I have some code to access the DSNs on the local machine, but I am getting an error

Dim objDSN As Dsn
Dim strDSArray() As String
Dim I As Long

Set objDSN = New Dsn

objDSN.GetDataSourceList strDSArray()

'list drivers

'list dsns
For I = LBound(strDSArray) To UBound(strDSArray)
lstDNS.AddItem strDSArray(I)
Next I

I just need to know what reference I need to add to access the Dsn. I get an error that user-type not defined.

Thanks in advance

Tonatiuh
Jul 10th, 2000, 05:33 PM
As far as I know, there is not a DSN dataa type. May be it could be posible by another way. What exactly do you want to do? Do you want a list of DSN or alist of ODBC drivers?

Negative0
Jul 11th, 2000, 06:25 AM
I just want the DSN's. I got this code off this site and nobody said what references you need to make to get this code to work.

Tonatiuh
Jul 11th, 2000, 08:20 AM
You can get them from registry.

The User DSN are in:
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI

The System DSN are in:
HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI

Good Look!

Clunietp
Jul 11th, 2000, 10:54 AM
Add a reference to:

ODBC Driver & Data Source Name Functions

Negative0
Jul 11th, 2000, 12:40 PM
That reference is not in my references list. What is the DLL that is associated with that reference.

Tonatiuh
Jul 11th, 2000, 04:54 PM
In my PC is: \Windows\System\msado15.dll

Maybe you need to install the MDAC. You can download it from microsoft page.

Negative0
Jul 11th, 2000, 06:10 PM
Thanks guys you helped out a lot.