Whilst you could just execute the following TSQL command:
select name from master..sysdatabases
to obtain the list of databases on a SQL Server box, it's far more fun to try and do it the SQLDMO …
Using SQLDMO within .net isn't the easiest thing to find information about, so here goes with some documentation.
The first thing that you need to do is add a reference to the SQLDMO library. With . …