Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enumerate SQL Servers?

12 views
Skip to first unread message

Harry

unread,
Sep 13, 2002, 5:29:10 AM9/13/02
to
I'm trying to enumerate all available SQL servers on the network.

I've used code from MSKB Article - Q287737
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q287737&

However I receive this error "QueryInterface for interface SQLDMO.NameList
failed."

Does anyone know what the cause of, and solution to this error is?

I'm using VB.NET & I've referenced the Microsoft SQLDMO Object Library.

Code from KB follows...
---------------------------------------------
Private Sub Command1_Click()
Dim i As Integer
Dim oNames As SQLDMO.NameList
Dim oSQLApp As SQLDMO.Application
Set oSQLApp = New SQLDMO.Application

Set oNames = oSQLApp.ListAvailableSQLServers()
List1.Clear
For i = 1 To oNames.Count
List1.AddItem oNames.Item(i)
Next i
End Sub
-------------------------------------------------------------

Thanks
Harry

Dan Haught

unread,
Sep 13, 2002, 8:53:17 AM9/13/02
to
Hi Harry,

Your code is correct. However there is a documented issue with SQLDMO that
causes this error. You'll probably need to apply a service pack to your
installation of SQLDMO to get this to work. Look for SQL Server 2000 SP2.
Since SQL DMO runs on the client, you'll need to install the service pack on
any client where you want to code to run.
--------------------------------------------
Dan Haught, FMS Inc.
* Total .NET XRef: C# and VB.NET Code Cross Reference
* Total .NET Analyzer: C# and VB.NET Error, Standards, and Performance
Analysis
Download today at: www.fmsinc.com/dotnet

"Harry" <ha...@nospam.com> wrote in message
news:O#auWfwWCHA.1752@tkmsftngp10...

Harry

unread,
Sep 13, 2002, 9:03:52 PM9/13/02
to
Thank you Dan. That solved it.

Regards
Harry

"Dan Haught" <dha...@NOSPAMfmsinc.com> wrote in message
news:uquwpRyWCHA.1164@tkmsftngp10...

0 new messages