Check to see if MySQL ODBC 3.51 Driver is installed

How can I check if MySQL ODBC 3.51 Driver is installed on a PC?

and if it is not installed, Install it?

Please help ASAP.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MirtheilSoftware DeveloperCommented:
Is this within an Install program or within your application?  Either way, you're going to want to check the ODBC registry key for the driver.  The base key is at:
From there, you can check for the MySQL driver. It would be a String Value with the driver name as the name and "Installed" as the value.  If it's not there, you can call out to the ODBC driver install package.  
DickSwart6Author Commented:
Ok, How do I Do Both?

It will be better id I can do it when I Install the App, but if I have to I do it in the app itself.

Now the question is HOW?

MirtheilSoftware DeveloperCommented:
Which install tool are you using?  Most install tools offer a way to check a registry setting and then perform an action like launching an external program (like the ODBC Driver package).  
DickSwart6Author Commented:
Visual Studio Instaler, Where and how?
MirtheilSoftware DeveloperCommented:
I don't have VSI installed on my system so I'm not sure how it would work.   Personally, I use InnoSetup (  Here's a simple InnoSetup script that does it.

;Script created by Mirtheil

#define MyAppName "My Program"
#define MyAppVerName "My Program 1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL ""
#define MyAppExeName "MyProg.exe"


Name: "english"; MessagesFile: "compiler:Default.isl"

Filename: "{src}\mysql-connector-odbc-3.51.12-win32.msi"; Description: "MySQL"; Check: IsMySQLOdbcInstalled;


function IsMySQLOdbcInstalled(): boolean;
Installed: Boolean;
bRes : Boolean;
sExec : string;
ResultCode, iMsgRes: Integer;
Filename, Params: String;

Result := false;
sExec := '';
bRes := RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\ODBC\ODBCINST.INI\ODBC Drivers',
     'MySQL ODBC 3.51 Driver', sExec);
if (not bRes) then
  //It's not installed.
  MsgBox('Not Installed.', mbInformation, MB_OK);
  result := true;
  //We want to double check that it is installed.
  if (sExec = 'Installed') then
    MsgBox('Installed', mbInformation, MB_OK);
    Result:= false; //We set it to false so the install isn't run in the "Run" section.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.