I am posting this on both the general and database forums:

I'm writing an app to read field info from a database table (schema data) and dynamically build a form based on the fields in that table. That part I'm okay with.

To dynamically build the connection string, I'd like the user to be able to choose what SQL Server they want, and what database within that server they are interested in. So my questions are:
(1) How can I find the names of the available SQL Servers on a system?
(2) For each of the available servers, how can I get the names of the databases within them (like "pubs", "northwind", etc.)?

TIA for your help.