This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: ODBC DSN List
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 22, 2010
09:05 PM
ODBC DSN List
Hi
I am trying to display a list of already created system\user dns's. I would like the user to be able to select the chosen dsn from a dropdown\combo list.
I have already noted a few threads that mention using the registry or ODBC.INI file, but nowhere actually explains how to do this.
thanks
I am trying to display a list of already created system\user dns's. I would like the user to be able to select the chosen dsn from a dropdown\combo list.
I have already noted a few threads that mention using the registry or ODBC.INI file, but nowhere actually explains how to do this.
thanks
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 22, 2010
09:36 PM
What project type are you using?
For a Basic MSI, you need to write a custom action that can enumerate HKLM\SOFTWARE\ODBC\ODBC.INI and emit the results into the ListBox or ComboBox table using temporary rows.
I do find this request a little unusual though. Although it's been a great many years since I actually used ODBC, I recall I'd typically install the datadriver and configure a system dsn of my choosing rather then give the user this type of choice.
For a Basic MSI, you need to write a custom action that can enumerate HKLM\SOFTWARE\ODBC\ODBC.INI and emit the results into the ListBox or ComboBox table using temporary rows.
I do find this request a little unusual though. Although it's been a great many years since I actually used ODBC, I recall I'd typically install the datadriver and configure a system dsn of my choosing rather then give the user this type of choice.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 22, 2010
09:52 PM
Thanks Christopher for the quick reply, much appreciated.
I have been given the wonderful task of creating a setup for an old school piece of software, and i have been told that i need to display a dns list for the user to pick from.
I am hoping that future releases will be dns-less 🙂
Can you point me in the right direction of some sample code to do this?
I have been given the wonderful task of creating a setup for an old school piece of software, and i have been told that i need to display a dns list for the user to pick from.
I am hoping that future releases will be dns-less 🙂
Can you point me in the right direction of some sample code to do this?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 23, 2010
12:18 AM
I managed to do as suggested and enumerate throught the ODBC.ini registry keys. Below is my solution for reference.
//Read the HKLM\SOFTWARE\ODBC\ODBC.INI to retrieve a list of DSNs to
//display in a list
prototype BuildDSNList(STRING);
#define KEY1 "SOFTWARE\\ODBC\\ODBC.INI"
#define RES_DSNLIST 1320
function BuildDSNList(szDialogName)
NUMBER nReturn;
LIST listSubKeys;
begin
//Create the list to hold values returned by RegDBQueryKey.
listSubKeys = ListCreate(STRINGLIST);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//Get the list of subkeys.
nReturn = RegDBQueryKey(KEY1, REGDB_KEYS, listSubKeys );
//Fill dialog combo RES_DSNLIST with results listSubKeys
CtrlSetList(szDialogName, RES_DSNLIST, listSubKeys);
//Set the default value in the list
CtrlSetCurSel(szDialogName, RES_DSNLIST, "ODBCDSNNAME");
//Remove the lists from memory.
ListDestroy(listSubKeys);
end;
//Read the HKLM\SOFTWARE\ODBC\ODBC.INI to retrieve a list of DSNs to
//display in a list
prototype BuildDSNList(STRING);
#define KEY1 "SOFTWARE\\ODBC\\ODBC.INI"
#define RES_DSNLIST 1320
function BuildDSNList(szDialogName)
NUMBER nReturn;
LIST listSubKeys;
begin
//Create the list to hold values returned by RegDBQueryKey.
listSubKeys = ListCreate(STRINGLIST);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//Get the list of subkeys.
nReturn = RegDBQueryKey(KEY1, REGDB_KEYS, listSubKeys );
//Fill dialog combo RES_DSNLIST with results listSubKeys
CtrlSetList(szDialogName, RES_DSNLIST, listSubKeys);
//Set the default value in the list
CtrlSetCurSel(szDialogName, RES_DSNLIST, "ODBCDSNNAME");
//Remove the lists from memory.
ListDestroy(listSubKeys);
end;