Try:
using (SqlConnection con = new SqlConnection(@"Data Source=GRIFFPC\SQLEXPRESS;Integrated Security=True"))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("sp_databases", con))
{
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader read = cmd.ExecuteReader();
while (read.Read())
{
Console.WriteLine((string)read["DATABASE_NAME"]);
}
}
}
That will list the databases on a single server.