Link to home
Start Free TrialLog in
Avatar of CraftLord
CraftLord

asked on

How to retrieve a list with current dsn names

Need to create a selection dialog where the users of my program can select the odbc dsn names.
So the program can dynamically access different databases.
Avatar of DEEPESH
DEEPESH

You have to use following apis

Declare Function SQLDataSources Lib "ODBC32.DLL" (ByVal henv&, ByVal fDirection%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDescription$, ByVal cbDescriptionMax%, pcbDescription%) As Integer

Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)

Public Const SQL_SUCCESS As Long = 0

Public Const SQL_FETCH_NEXT As Long = 1

or another way is to read registry all dsn are stored in registry under
HKEY_Local_Machine --Software--odbc remember these will be system level dsn
ASKER CERTIFIED SOLUTION
Avatar of Manish Chhetia
Manish Chhetia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial