string constr = "server=.;database=master;uid=sa;pwd=";
SqlConnection conn = new SqlConnection(constr);
conn.Open();
SqlCommand cmd = new SqlCommand("select name from sysdatabases", conn);
SqlDataReader sdr = cmd.ExecuteReader();
while (sdr.Read())
{
Response.Write("<br>" + sdr.GetString(0));
}