Solved

C# Detect if SMO is installed on a client PC

Posted on 2010-11-08
3
824 Views
Last Modified: 2013-12-16
I have an application which uses SQL Server Management Objects which is installed onto client PCs.  I need to know whether or not SMO is installed on the PC and if not to install it.  I thought that code of

try
{
  Server server = new Server(connection);
}
catch (Exception)
{
  // SMO not installed so install
  ...
}

would work but the exception is not caught even if SMO is not installed - I only get an exception when I try and use the object which is a bit late really  Is there a way in .NET 3.5 to determine whether or not the SMO Dlls are installed?
0
Comment
Question by:ChrisMDrew
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34086657
The most reliable way is probably going to be to check the registry.

The sample posted here should point you in the right direction:

    http://stackoverflow.com/questions/42438/whats-the-best-way-to-detect-the-presence-of-smo
0
 

Author Comment

by:ChrisMDrew
ID: 34088337
Hi - yes I've seen that post however it doesn't seem to work for me as I don't have that registry key yet do have SMO 2008 installed...
0
 

Author Closing Comment

by:ChrisMDrew
ID: 34144276
Found another registry key which did work!  Also checked for the DLL in the appropriate fold4er for safety
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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