Out of this: Enumerate all running databases

It's possible to list the servers around the network, but when one chooses among individuals servers, how do you then list the DB's for the reason that server, using a similar method as above?


Most interactions having a database server eventually translate to SQL. Even when they appear like another API inside a greater level. Search for the SQL to get this done and merely refer to it as from C#

UPDATE: From here

----SQL SERVER 2005 System Procedures
EXEC sp_databases
EXEC sp_helpdb
----SQL 2000 Method still works in SQL Server 2005
FROM sys.databases
FROM sys.sysdatabases
----SQL SERVER Un-Documented Procedure
EXEC sp_msForEachDB 'PRINT ''?'''

You should use SQL Management Objects (SMO). First, you'd make use of the SmoApplication class and something of their EnumAvailableSqlServers techniques to obtain the server.

Once you have found the server you would like, you'd produce a Server instance, after which use its Databases property.