title: How to list all database names from SQL Server in ASP.NET MVC 5?
body: <p>I'm trying this code in controller but it doesn't work ... </p>
  
  <pre><code>Server myserver = new Server(".");
  DataTable servers = SqlDataSourceEnumerator.Instance.GetDataSources();
  
  DatabaseCollection mydata = myserver.Databases;
  
  foreach (Database db in myserver.Databases)
  {
  
  }
  </code></pre>