Hi,
I would like some help with what the best way is to return a list of the
Server names on a network using VB .NET.
I found a reference to the dbserverenum function, is this the best thing to
use, I was unable to find any examples? I would be most grateful if someone
could provide some robust example code of the best way to do this.
Many thanks.Hi
I'm sure you can use SQLDMO object to list all servers
Dim i As Integer
Set oSQLServerDMOApp = New SQLDMO.Application
gShowServerEvents = False
Dim namX As NameList
Set namX = oSQLServerDMOApp.ListAvailableSQLServers
For i = 1 To namX.Count
txtServer.AddItem namX.Item(i)
Next
--
or call the following SP from vb.net
--
CREATE PROCEDURE dbo.ListLocalServers
AS
BEGIN
SET NOCOUNT ON
CREATE TABLE #servers(sname VARCHAR(255))
INSERT #servers EXEC master..XP_CMDShell 'OSQL -L'
DELETE #servers WHERE sname='Servers:'
SELECT LTRIM(sname) FROM #servers WHERE sname != 'NULL'
DROP TABLE #servers
END
"11Oppidan" <11Oppidan@.community.nospam> wrote in message
news:efgTgepEFHA.628@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I would like some help with what the best way is to return a list of the
> Server names on a network using VB .NET.
> I found a reference to the dbserverenum function, is this the best thing
to
> use, I was unable to find any examples? I would be most grateful if
someone
> could provide some robust example code of the best way to do this.
> Many thanks.
>|||If you want the instances of sql server, then you can use SQL-DMO API,
specifically the ListAvailableSQLServers Method of the Application object.
http://www.microsoft.com/resources/... />
c3561.mspx
AMB
"11Oppidan" wrote:
> Hi,
> I would like some help with what the best way is to return a list of the
> Server names on a network using VB .NET.
> I found a reference to the dbserverenum function, is this the best thing t
o
> use, I was unable to find any examples? I would be most grateful if someo
ne
> could provide some robust example code of the best way to do this.
> Many thanks.
>
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment