Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting SQL Servers
Message
De
12/02/1999 11:32:12
Bob Tracy
Independent Consultant
Driftwood, Texas, États-Unis
 
 
À
11/02/1999 08:55:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00186452
Message ID:
00187051
Vues:
19
>>Does anyone know how to detect the active SQL Servers in a domain? In SQL Server you can show the active servers in the dialog used for registering server groups so there must be an API call somewhere. TIA
>
>You might look into using WNetOpenEnum() and WNetEnumResource() - I haven't tried finding SQL Server instances with it, so I don't know what would be involved in isaolating them in the list of all available shared resources on a given network.

Thanks for the suggestion but I found a SQL-DMO way while researching those API calls. It's a lot easier than I expected:

oSQL = CREATEOBJECT('SQLOLE.SQLServer')
oSQL.Disconnect
oSQL.Connect('satcim')
oApp = oSQL.Application
oApp.ListAnnouncedNetWorkSQLServers()
lnCnt = oApp.ListAnnouncedNetworkSQLServers().Count
FOR n = 1 TO oApp.ListAnnouncedNetworkSQLServers().Count
? oApp.ListAnnouncedNetworkSQLServers().Item(n)
ENDFOR
oSQL.DisConnect
oApp.Quit
Release oApp,oSQL

I haven't looked too hard at SQL-DMO in the past, but I think I'll see what else it will . Looks interesting!
Bob Tracy

Never engage in a battle of wits if you're only half armed.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform