Monday, March 26, 2012

How Detect SMO is installed?

Hi all

I'm using Microsoft.SqlServer.Management.Smo namespace for retrieve a list of avaible SQL Servers.

The problem is when SMO is not installed in the client machine. The application crashes although I put the command in a try - catch block.

try { DataTable dtSQLServers = SmoApplication.EnumAvailableSqlServers(false); }

catch { notInstalled = true }

Are there any easy way to know if SMO is installed , so i can advice the user that he must install SMO first?

Thanks.

You either have to lookup the file references assembly or use a component to check the reference to the GAC: http://www.codeproject.com/dotnet/Assemblydependencies.asp?df=100&forumid=31276&exp=0&select=977211

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment