January 15, 2002 at 12:59 pm
I would like to show my users a combo box that lists the names of SQL Servers that exist on a network. How can I do this before I have connected to an existing SQL Server machine? Anyone have any VB examples?
January 15, 2002 at 6:24 pm
Looks like the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\TDS maintains a list of SQL Servers previously accessed.
January 16, 2002 at 2:54 am
SQLDMO has an application object that in turn has a function called 'ListAvailableSQLServers' that (strangly enough) returns a list of SQL servers on your network.
It's not perfect - it does some sort of network discovery thing, and dosnt find all servers all of the time - especially if you have switches etc on your network. It also seems to often list 'ghosts' - servers that no longer exist. I've also got cases where there are multiple entries for the same server - i think thats to do with having more than one protocol running.
January 16, 2002 at 4:19 am
I've got some code in a one of my DMO articles you can use - the listservers method...is oh, unusual - doesnt quite return an object.
Andy
January 16, 2002 at 6:46 am
See dbserverenum in Books on-line. -JG
-JG
January 16, 2002 at 11:58 pm
Also, if you have Active Directory and don't want to write C code, you can query AD for SQL servers, provided that they've been registered with AD (most often they are). Using the AD OLEDB provider to connect to AD data source, you can query the active directory like you would any OLEDB-compliant datasource.....More info--in
MSDN and BOL.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply