My installer needs to run an SQL ODBC test. This is done as a custom event using the built-in TestSqlConnection custom event. The [SqlConnectionString] parameter, however, has to be filled in with the MySQL ODBC driver name, e.g. "Driver=[\{]MySQL ODBC 5.1 Driver[\}];Server=[HOSTNAME];Port=[PORT];Uid=[USER];Pwd=[PASSWORD];".
If the installer runs on a PC that has this version of the MySQL ODBC driver on it, the installer does the job perfectly. However, if the PC being installed onto has a different version of the MySQL ODBC driver (say v5.2w) this custom action fails as it can't find the driver for v5.1.
Is there therefore any way to do the following?:
1) Detect which version of the MySQL ODBC driver is installed;
2) Use that in the custom string above.
I can't find any registry key or file that contains the required information. The registry does have the key HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB\MySQL Connector/ODBC 5.2(w), containing the setting Version, but I can't search for that registry key as the key itself contains the version number. There's also the registry key HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 5.2w Driver, but again that contains the version number as part of the key itself.
So is there any way to enumerate a number of registry keys and match on the one containing the text "MySQL ODBC" in it?... Other than in a 3rd party DLL that is?
Thanks,
Nick.