using System;
using System.Collections.Generic;
using System.Text;
using smo = Microsoft.SqlServer.Management.Smo;

namespace ActiveConnections
{
    class Program
    {
        static void Main(string[] args)
        {


            smo.Server localhost = new smo.Server();
            smo.Database database0 = localhost.Databases["Scratch"];
            smo.SqlSmoObject so = (smo.SqlSmoObject)database0;
            //smo.Property activeConnections = so.Properties["ActiveConnections"];
            foreach (smo.Property p in so.Properties)
            {
                if (p.Name == "ActiveConnections")
                {
                    smo.Property p2 = so.Properties[p.Name];
                    Console.WriteLine(p2.Name + " " + p2.Value);
                }
            }

        }
    }
}
