Can anybody explain me what I wrong I am doing in the following piece of code:
DataTable dt=SmoApplication.EnumAvailableSqlServer(true);
Server sr = new Serv
using Microsoft.Win32;
RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server");
String[] instances = (String[])rk.GetValue("InstalledInstances");
if (instances.Length > 0)
{
foreach (String element in instances)
{
Console.WriteLine(element); // element is your server name
}
}