1

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?

Justin
  • 84,773
  • 49
  • 224
  • 367
62071072SP
  • 1,963
  • 2
  • 19
  • 38
  • Maybe it helps: http://stackoverflow.com/questions/141154/how-can-i-determine-installed-sql-server-instances-and-their-versions – Samich Sep 27 '11 at 09:57
  • @Samich I dont want instances and their references – 62071072SP Sep 27 '11 at 09:59
  • 1
    @ShaliniPavan If you don't want SQL Server instances then you should update your question to make it clear what you do what - at the moment the question seems very much like you are asking for a list of SQL Server instances. – Justin Sep 27 '11 at 10:58

1 Answers1

2

If you dont find it than you can google it and than you can pass the reference of it the simplest way to achive it.

Check this answer : http://social.msdn.microsoft.com/forums/en-US/sqlsmoanddmo/thread/883d89df-fb19-4b04-ab83-1006a3559476/

Do Install : Microsoft SQL Server 2008 Feature Pack, October 2008

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263