I am trying to get list of all SQL Servers installed in the machine and populate them in a drop downlist. I have searched in google and tried the following:
using System;
using System.Data;
using Microsoft.SqlServer.Management.Smo;
namespace SMOTest
{
class Program
{
static void Main()
{
DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Console.WriteLine(dr["Name"]);
}
}
}
}
}
However I didn't find a reference for Microsoft.SqlServer.Management.Smo;
What is the best way to get all the sqlserver names and populate it in a drop down list?