Solved

Return a list of all installed ODBC drivers

Posted on 2013-01-25
8
743 Views
Last Modified: 2013-01-26
Hi,

I'm finalizing a small project I'm working on and I would like to be able to return a list of all installed ODBC drivers to the user so they can select one to use.

Currently, when my project is installed and run on a computer for the first time the user is asked to supply MySQL Server Name, Database, username and password.  All this data is saved to an INI file and is used to run a DNSless connection string to join the required tables from the MySQL server.

My reason for asking this question is this.  Currently the ODBC driver is hard coded into my code and therefore requires the end user to install a specific MySQL ODBC driver.  What I would like to do is allow the user to install any MySQL ODBC driver and then, when they run the programme for the first time they can select the driver from a listbox, enter the relevant server information and continue with the application as normal.

Can anyone point me in the right direction?
0
Comment
Question by:anthonytr
  • 5
  • 3
8 Comments
 
LVL 57
ID: 38819735
<<Can anyone point me in the right direction? >>

See the following:

http://msdn.microsoft.com/en-us/library/ms714818(v=vs.85).aspx

 The reg key is valid up through Windows 7 at least.

 Not sure about 32 vs 64 bit drivers though.

Jim.
0
 
LVL 57
ID: 38819739
You want the drivers sub-key by the way.

Jim.
0
 
LVL 57
ID: 38819748
I just looked.  On a 64 bit OS, the 32 bit drivers will be in:

HKLM\Software\Wow6432Node\ODBC\ODBCINST.INI

Jim.
0
 

Author Comment

by:anthonytr
ID: 38819790
Thanks Jim for this.  How would i display this information in a Listbox to the user?

For example my current connection string is:

stConnect = "ODBC;Driver=MySQL ODBC 5.2a Driver;Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";Trusted_Connection=Yes"

As you can see ODBC;Driver=MySQL ODBC 5.2a Driver is my installed and hard coded driver.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 57
ID: 38819910
You can use the code in the following blog to read the key:

http://blogs.msdn.com/b/alejacma/archive/2008/04/11/how-to-read-a-registry-key-and-its-values.aspx

  You'll then need to feed the list box.  Not sure exactly what your working in.  You could dump the data into a table and hook the list box to that, stuff the values into the list box one by one, or have a call back function to fill the list control and requery it.

Jim.
0
 

Author Comment

by:anthonytr
ID: 38819997
Thanks, I'm running MS Access VBA.
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 38820078
<<Thanks, I'm running MS Access VBA. >>

 The code for reading the reistry key will drop right in and all of the methods I mentioned would be doable for getting the data into the list control, plus additionally, you could set the list control rowsource to value and fill the rowsource.

 So there are four different ways to get the data into the list control.

 Given the limited number of entires you would have (couple dozen at most), I would opt for using a value list or a callback function.

Jim.
0
 

Author Comment

by:anthonytr
ID: 38820154
Thank you!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now