using System.Data;
using System.Data.SqlClient;
…
// Substitute your connection string below in conxString
String conxString =
“Data Source=MYSERVER; Integrated Security=True;”;
using (SqlConnection sqlConx = new SqlConnection (conxString))
{
sqlConx.Open();
DataTable tblDatabases = sqlConx.GetSchema (“Databases”);
sqlConx.Close();
foreach (DataRow row in tblDatabases.Rows)
{
Console.WriteLine (“Database: ” + row[“database_name”]);
}
}
using System.Data; using System.Data.SqlClient; ... // Substitute your connection string below in conxString String conxString = "Data Source=MYSERVER; Integrated Security=True;"; using (SqlConnection sqlConx = new SqlConnection (conxString)) { sqlConx.Open(); DataTable tblDatabases = sqlConx.GetSchema ("Databases"); sqlConx.Close(); foreach (DataRow row in tblDatabases.Rows) { Console.WriteLine ("Database: " + row["database_name"]); } }