Enumerate SQL server list?

E

Earl

Anyone know how to enumerate the SQL Servers on a network using .Net? I can
do this with VB6, but howso in .Net?
 
E

Earl

Hi Mika,

This is essentially the same thing I'm doing now in VB6, but I was looking
to see if there was another way to not use a COM reference in order to do
this with .Net. Maybe this is the wrong way of looking at this -- what am I
giving up using COM here? Incidentally, I've been on that RightHand site in
the past, good stuff you folks are building over there.

Miha Markic said:
Hi Earl,

One way would be:
Q287737
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q287737&

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Earl comcast net> said:
Anyone know how to enumerate the SQL Servers on a network using .Net? I can
do this with VB6, but howso in .Net?
 
E

Earl

Miha,

Using this VB6 method, I get an invalid cast exception when I try to create
an object for the namelist (Dim oNames As SQLDMO.NameList). Even with a
Try-Catch, I still get the exception: "Query Interface for interface
SQLDMO.Namelist failed." Is this a COM wrapper issue?


Miha Markic said:
Hi Earl,

One way would be:
Q287737
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q287737&

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Earl comcast net> said:
Anyone know how to enumerate the SQL Servers on a network using .Net? I can
do this with VB6, but howso in .Net?
 
G

Guest

I'm going to assume your using SQL Server 2000. You will get this exception if you have not upgraded to SP2. So you want to make sure you're using at least SP2 with this code.
 
E

Earl

Thanks Roy. Yes, SQL Server 2000 for development, although I intend to
attach my interface to an MSDE installation. Not sure about the SP, so I'll
give it a go.

Roy said:
I'm going to assume your using SQL Server 2000. You will get this
exception if you have not upgraded to SP2. So you want to make sure you're
using at least SP2 with this code.
 
E

Earl

No joy even with SP3a installed. Somewhat frustrating, as I've not found
anything on this published anywhere. I mean, how uncommon can it be to have
to enumerate the server list in .Net?? Thanks again for the pointer Roy.

Roy said:
I'm going to assume your using SQL Server 2000. You will get this
exception if you have not upgraded to SP2. So you want to make sure you're
using at least SP2 with this code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top