Tuesday, March 27, 2012

EnumAvailableSqlServers() fails to detect LOCAL installed instance when disconnected from ne

I am using EnumAvailableSqlServer to build the standard select Sql Server dialog with controls to select the server, instance and database. This all works fine - other than the well reported problem of detected multiple instances - however I have noticed that when disconnected from the network the call fails to even detect the locally installed sql servers.

What is the recommended method of determine whether an instance of sql server is installed locally. I can call Server->Databases, but this leads to a timeout / excpetion if no instances are detected which is slow. Is there a recommended registry key I can check that won't change between versions or another API I can try.

hx, Nick

Checking registry seems the simplest ...

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server

with InstalledInstances value.

Thx, Nick

No comments:

Post a Comment