using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace AdoDatabaseList
{
    class Program
    {
        static void Main(string[] args)
        {
            SqlConnectionStringBuilder sb =
                new SqlConnectionStringBuilder();
            sb.DataSource = "CANOPUS5";
            sb.IntegratedSecurity = true;
            SqlConnection conn =
                new SqlConnection(sb.ConnectionString);
            conn.Open();
            SqlCommand cmd = new SqlCommand(
                 @"SELECT dtb.name AS [Name] FROM
                   master.sys.databases AS dtb
                   ORDER BY [Name] ASC",
                   conn);
            SqlDataReader rdr = cmd.ExecuteReader();
            while(rdr.Read())
            {
                Console.WriteLine(rdr[0]);
            }
        }
    }
}
