Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List of available SQL Servers ?

Status
Not open for further replies.

StevenK

Programmer
Joined
Jan 5, 2001
Messages
1,294
Location
GB
How can I obtain a list of available SQL Servers from a given client machine ?
In the same sense as I would get a list of servers from the SQL Server Service Manager (or from drop down list when creating ODBC connections) ?
Any clues ?
Steve
 
I use Microsoft SQLDMO 8.0 library. The code is:
SQLDMO.Application sqlApp = new SQLDMO.Application();
SQLDMO.NameList NL = sqlApp.ListAvailableSQLServers();
for (int i = 1; i <= NL.Count; i++)
cboServers.Items.Add(NL.Item(i).ToString());
 
The code looked all well and good. :)
However, when I run it I get the error message :
"QueryInterface for interface SQLDMO.NameList failed."
What would cause this ?
It looks like I'm almost there with it.
Thanks for the help so far.
Steve
 
Maybe problem is in istalations. Give me you current windows and SQL server instalation status. I mean which service pack you have on windows, on SQL server and version of visual studio.
My current status is :
Servers have windows server 2000 with service pack 4 and the SQL servers 2000 installed have service pack 3. Other computers have windows xp prof with service pack 1 and patches and with MDAC 8. Also we use Visual studio 2003 for development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top