I've also read that SMO works with SQL Server 2008 but simply doesn't want to list my instances.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
using System.Data;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
DataTable table = SmoApplication.EnumAvailableSqlServers(true);
foreach (DataRow row in table.Rows)
{
Console.WriteLine("-- {0} -- {1} -- {2} -- {3} -- {4} -- ", row[0], row[1], row[2], row[3], row[4]);
}
}
}
}
It just gets me the server name : BOGDAN-LAPTOP, not the instances;I have MSSQLSERVER and SQLEXPRESS 2008 instances.
I've tried the same code on a PC with SQL Srver 2005 instaces and works.
What's wrong with that ?
I've included the assembly from C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll and also from C:\Program Files(x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll because I have x64 Win 7, with the same result.