This question really belongs in the SQL / ADO / ADO.NET forum. You can list all the databases on a SQL Server with the following query on a connection to the master database:
SELECT name FROM sysdatabases
ColinMackay.net "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell