PDA

Click to See Complete Forum and Search --> : How to List DSN on Local Machine ?


Gregorius
May 27th, 2000, 03:06 PM
Is there a way that I can LIST and retrieve the attributes of all ODBC Datasource Names on the local machine from a VB app, and possibly the DSN's on a remote machine ?

Any pointers?

Thanks

Gregorius

Clunietp
May 28th, 2000, 03:44 AM
this will list all ODBC DSN & driver info

'uses [ODBC DRIVER & DATA SOURCE NAMES AND FUNCTIONS] library

'lists all ODBC Drivers
'lists all DSNs

Dim objDSN As ODBCTool.Dsn
Dim strDriverArray() As String
Dim strDSArray() As String
Dim I As Long

Set objDSN = New Dsn

objDSN.GetOdbcDriverList strDriverArray()
objDSN.GetDataSourceList strDSArray()

'list drivers
For I = LBound(strDriverArray) To UBound(strDriverArray)
Debug.Print strDriverArray(I)
Next I

'list dsns
For I = LBound(strDSArray) To UBound(strDSArray)
Debug.Print strDSArray(I)
Next I


as far as getting the attributes of each one, you'll probably have to become friendly with the ODBC API....

Tom