Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Getting SQL Server Instance List With NetServerEnum

Hi everyone,

I've been doing research yesterday for several hours without finding what I was really looking for.

I need to get a list of SQL Server available on the network with their instance name. This is simply to populate a combo box in Access to let the user choose their server location.

I saw a couple answers on this board regarding this question, and most of the answers were to use the "SQLDMO" object and its references. But I don't want to do that because that would imply deploying those librairies to all computers just to ease up on the programming.

I know there is a way to list the SQL Servers from the NetServerEnum but the problem is that the instances names are missing from that list.

If you go through the ODBC Data Sources in windows, Windows is able to get a list of all the SQL servers and instances names, so why can't we?

I found a function called SQLBrowseConnect() that I guess is from the ODBC32.dll but I can't get any good example for VBA and how to use it.

Let me know your thoughts.

Thanks a lot.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Path Of Server To Create An Instance Of A DLL On Server
If one is working in an INTRANET (not internet) and the DLL i want to use in my Vb applicaiton is on a a server named "SERVER-X" then how do i code my application so that it knows where to look for the dll and create an instance ?

Long Question I know ! I think the VB writer Sam Huggil might have the answer to this !

Only One Instance On A Server??
I got a program on a server with many user. I dont want them to open more then one instance of my prog. For example: if my prog is in use by user 1 and user 2 are trying to start my prog, then he would not be allowed to do that until user 1 has closed my prog.

i use this code

and it works fine

BUT there is a VMS machine on the network and it comes up ok but it says the OS is Windows NT 4.2

y is that?

y doesnt it come up with VMS???

BUT if i just select to view the unix servers, that is the only one that comes up

and if i select to view only windows servers it doesnt come up

any help would be greatly apreciated

NetServerEnum ?
I am building a list of Servers on our network utilizing the NetServerEnum API call as follows:

VB Code:
L = NetServerEnum(ByVal 0&, _                      Level, _                      bufPtr, _                      PrefMaxLen, _                      EntriesRead, _                      TotalEntries, _                      SV_TYPE_SERVER Or SV_TYPE_DOMAIN_CTRL, _                      Domain(0), _                      hResume)

The problem I'm having is that I'm getting NT Workstations, Windows 2000 workstations, and some Windows 98 workstations included the returned data. Anyone have any idea's why these machines would be returned as servers?

I went to MSDN to find NetServerEmum. I have found what i need, well sort of. I have five pages of explanation that i don't understand. Does anyone happen to have an example??

How To Populate A Word Document In Server By Creating A Word Instance On Server.

How to populate a word document in server by creating a word instance on server. I am developing a client server application, we don't have MS-Word in the client machine, but i want to create a word document on server by sending the content to a function.

Please let me know the possibilities.


Single Instance Server
I have a weather station on my home that sends weather data out a serial port. I would like to create a server object that will monitor the weather station. All this is easy, what I need is to be able to call that server and get the weather data from any application. Specifically the server will run as a windows NT service and continually monitor the data stream. How do I create the server so that when a client wants data it can communicate with the server and get the data. I wanted to use com, but I can't see how to let a client get the data from the server withought the client creating another instace of the server. I can only have one instance of the server that will allways be running. I hope to just expose some properties of the server to be read by the client. Any ideas how to do this? I don't know quite how to make this inter process communication take place. I don't want to use TCP/IP, I would like it easily callable from asp.



Netserverenum Is A C Call.
netserverenum is a C call to the Domain Controler for a list of all servers in the domain. Is their a similar VB function for this?

NetServerEnum API CALL
NetServerEnum API.

The Api which enumerates netowrk objects in my case SQL Servers.

Can someone tell me if I am correct in thinking this.

If a server wsa to go down after an hour or so say and just after this point I run the api call to check servers on the network, would the API still return the failed server.

Ive read and just want to be sure that it can take upwards of 15mins before the master server updates whats happening....

Thanx again in advance...

NetserverEnum Oracle Tag
Hi all,

Can somebody please help me by mentioning the tag, hex or binary constant value used, to identify Oracle DB server in a network.

Hope to get a reply soon....


Creating Single-INSTANCE Server
I need to create single-instance(not single use) server, e.g. One instance of the server for all clients. The instance should contain data of all clients. I don't know to do it, the only possible way is to use persistable property, but it would be rather complicated. This server is used as a remote server. I am using VB6E.
All help is very welcome. TIA

Get Ptr To Instance Of Server On Remote Host
is there a way of getting a pointer to an instance of a COM exe server running on a remote host?


Connection String For SQL Server Instance Names
I have an SQL server on my local machine called:
Most of my data is selected from IJ_WDSTK_PRODUCTION but sometimes I have to get some data from IJ_WDSTK_PROD_DATA_MART. When I do this I use this string:

SELECT ID, destination as description
FROM IWDSWKS150IWDSWKS150.IJ_WDSTK_PROD_DATA_MART.dbo.Product_Destination ORDER BY description
but I keep getting the error message: Line 2: Incorrect syntax near ''
When I execute select @@servername in query analyser, I get the result:IWDSWKS150IWDSWKS150.
How can I get the query string to work?

How To Attach A Database File In Instance Of SQL SERVER
Possible via vb classic to attach database .mdf in one instance of sql server via Visual Basic classic.
Admiting i have Mytdatabase.mdf in c:mydir

Edited by - luca91 on 12/28/2006 3:01:55 AM

Problem Binding To A Running Instance Of COM EXE Server Using GetObject()
Hi guys!
I am trying to bind to a running instance of a COM EXE Server application by using

This works at most of the places and many different machines. However, on one particular machine, I am unable to bind to the running instance using the above method. The problematic machine run exactly the same version of the application and OS as other machines. Reboot did not help.

I just get an error # 429.
"ActiveX Component cant create object"
OfCourse, I did register the application and walked through the REGISTRY and verified that its registered properly.

What can be the problem?

Parsing The List Recieved From The LIST Command On An FTP Server
I need to parse the list that is recieved from differnet servers. Now, the list is not always in the exactly same format, but always is in some kind of pattern.

This list is the directory information that you request. I need help in parsing it, into the different data it contains

I know of 2 main types of listing - UNIX-type and DOS-type.

The UNIX type is a more full, with serveral details like Owner, Group Permissions etc, while the DOS-type is like a scaled-down version of the UNIX type.

format of Unix Type

drwxrwxrwx 1 owner group 43 oct 18 1996 Directory number 1
-rwxrwxrwx 1 owner group 43 oct 18 1996 This is file 1.txt
-rwxrwxrwx 1 owner group 43 oct 18 1996 This is file 2 .txt
-rwxrwxrwx 1 owner group 43 oct 18 1996 This can be file 3 etc.txt
format of DOS-type

10-18-96 11:10AM 43 This is file 1.txt
10-18-96 11:10AM 43 this is File 1.txt
10-18-96 11:10AM 43 this is File 2.txt
But also there are other variations to those types. If all the responses followed that style, that would be no problem.

The unix-type can sometimes be sent like this.

drwxrwxrwx 1 owner 43 oct 18 1996 Directory number 1
The dos-type can sometimes be also sent like this

07-13-03 09:12AM 20151 diablo.jpg
07-13-03 09:12AM 11927 dls.jpg
07-13-03 01:44AM <DIR> doc
07-13-03 08:50AM <DIR> docu

I developed a parsing routine that first determines if the list is Unix/DOs type.

First it parses the list into lines

This can be done by checking for a "d", "-", or "l" at the begining of the line.

But all the different types of responses are not easy to generalize. There is no responsible RFC for generalizing them, or making them standard. It just says that they must be in a "Human-Readable Form".

I've seen FTP clients that do parse almost all (I've yet to see any client that is not parsed by a tested client).

Does anyone know a good routine, or anything that might help me on my venture in parsing ? hehe

thanks a lots in forward!

any help, more than appreciated!

PS: Didnt put this in the Communications cause i dont tink it has anything to do with Winsock, cause i am not asking HOW TO recieve the LIST command.

Use App.PrevInstance To Kill Previous Instance And Run Newset Instance
I want to detect if my program has already been runned.
If it has been runned(and still runs) then i want the NEW instance of my program to kill the old instance...

This is to make sure that the newest version of my program is running. And so that old bugs doesnt affect what im doing,cause the old instance of my app ALWAYS get killed by the NEW instance..

Need something like this:

VB Code:
If App.PrevInstance = True Then'this syntax does not work..but this is what i want to happen    Unload App.PrevInstance    End     App.PrevInstance End If

Please help me ou here!!!
Thanx In Advance,Folks !!

How To Get SQL Server List / Database List

Need your help on my problem. I suppose to provide an interface for the end user to select SQL Server and Database on the Selected SQL Server to logon. A lot of application can provide the list so the user do not need to key these information mannually. Any VB Expert can give me some suggestion on how to solve this issue ? Thanks.

Get All SQL Server List In VB 6.0
I am working on vb 6.0 and sql server. 2000
I want to get all available SQL server list.
Do I use SQlDMO to get all serverList.

help is appreciated,

Thanks & Regards


Sql Server List
Dear Team,
I am using the following coding to display the avaliable sql servers on the network. But it is giving the attached error message.Pls help.
I have installed SQL Server in my Machine.

VB Code:
Private Sub Command1_Click()    On Error GoTo 0    Dim sqlapp As New SQLDMO.Application    For Each thing In sqlapp.ListAvailableSQLServers        'Combo1.AddItem thing        Print thing    Next    End Sub

Get SQL Server List
hi guys i have a problem. i m getting sql servers list using SQLDMO . but it shows me the list of computer with in one network. i have different network segments . i want to show all computer list within my different network segments.
with regards
Hammad Umar

Server List
i have a chat program is there some way to have a list of chat rooms like if a person starts the server app it shows up on a servers list in the main lobby of my chat program and when people click on the sever in the list it will connect them to it

SQL Server List Box

I'm a bit of a vb newbie (although have been programming asp and vba for years, so I have a bit of a clue.)

Anyway I've created a form which inputs a value, then sends it off to a url and reads the repsonse which is an xml document.

What I need to do now is populate a value in the form with the ressults of a query from my sql server. I've acheived this, but I only seem to be able to populate a text box and I want to populate a list box; how is this done??

I've just used the form designer and dragged the query off a dataenvironment to get my ressults on the form. Yet when I try the same code on a list box, nothing is shown.

Please help


SQl Server List
Is there way that we can get the Sql server list from VB.
Thankx in advance.

Networking Server List
I made a VB networking game that turned out great, but you have to know the IP of the computer running the server to play. I want to list all available servers - if the user running the server wants too.

I have a web site that has ftp ability which that portion I don't use... but I don't see how that would help since I can't run programs on the web server (Besides Perl and all that crap) Any person disconnecting abnormally would not update the server list...

Most people will not have a static IP...

I have dsl so mine changes...

I thought of using one of those dynamic dns places, but I don't want to spend money.

What if I used each new user connection to try and log onto each server, and if they can't, delete the server from the list???

but then I thought a person with a 300 baud modem could wipe out my server list...

Any ideas?


List Tables On A Server
Is there an easy way to list all the tables (say, in a listbox) within a particular Oracle server (named Server12)?

I tried this piece of code I found posted from loquin

Dim rsSchema As ADODB.Recordset
Dim cn As ADODB.Connection

' Open the connection to your database.

Set rsSchema = New ADODB.Recordset

Set rsSchema = cn.OpenSchema(adSchemaTables)

Do While Not rsSchema.EOF
If rsSchema!Table_Type = "TABLE" Then
Debug.Print rscChema.Fields!Table_Name, rsSchema.Fields!Table_Type
End If

Set rsSchema = Nothing
but I get an error (Object variable or with block variable not set) on the line
Set rsSchema = cn.OpenSchema(adSchemaTables)
To be honest, I don't even understand what this code is supposed to be doing line-by-line. So, if anyone has a simple method for a simple (ignorant) newbie, it would be greatly appreciated!

List Of Files From A Server?
i have a program that will download a list of patches from my server but i am having real troubble getting these values into arrays! Each file is formatted as follows...

PatchName Patch_One
PatchSize 128000 (bytes)
FileName Patch1.exe

PatchName Patch_Two
PatchSize 178000 (bytes)
FileName Patch3.exe

... how would i get that into an array named "Patch" dimensioned as (1 to 3, 1 to 10)?

Also when downloading how can i display a progress bar or at least a counter saying how much has been downloaded?

SQL Server/Sproc List

(VB6, MS SQL Server 7.0)

I have a rather lengthy list of stored procedures for my database and have written a search program in VB6. I manually generate a single text file by selecting all the stored procedures and select Generate Script. Then I can search it.

Is there a way to automate the generation of this text file through VB or even better to get the text of a stored procedure? I am familiar with calling stored procedures and creating jobs and DTS packages, but the only way I can find in the help is to use the sqldmo.dll and I am not at all familar with that.

Any assistance would be greatly appreciated...


No Dropdown List For Ms Sql Server?

Before, I have made tables using MS Access.. one is a list of 'bank' (PK bank code) and the other one is a list of 'transaction' (FK bank code).. MS Access shows a dropdown list (whenever I enter data directly to the table 'transaction') for the bank using the FK bank code..

Now the question is, Is MS SQL Server capable of doing that (drop-down list thingy)?

Help With Ftp ( Get Server Files List)
hi to all
i need a help with ftp programe.....
this is the part of the code

PHP Code:

Dim hOpen As Long, hConnection As Long
Dim dwType As Long

Private Sub Form_Load()
    chkPassive.Value = 1
    optBin.Value = 1
     hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)

End Sub

Private Sub cmdConnect_Click()

        If txtServer.Text = "" Then
            MsgBox "Please enter a server name!"
            Exit Sub
        End If
        Dim nFlag As Long

            nFlag = 0
        hConnection = InternetConnect(hOpen, txtServer.Text, INTERNET_DEFAULT_FTP_PORT, _
        txtUser, txtPassword, INTERNET_SERVICE_FTP, nFlag, 0)

End Sub

how to edit cmdConnect button which make it after connect to server get the ftp server files in a List view....
and also how to delete or rename any file of them

How To List The Directories From A FTP Server
I am Using Internet Transfer Control to connect to the ftp server.How can I list the directories/folders of that server in a list box. I am using GETCHUNK command to get the directories.

Thanx in Advance...

SQL Server Service List??
Anybody know how to get a list of available SQL Servers, the same list that the SQL Server Service Manager does?

How Can I Get The User List From The Server
How can i get the users list from the server created by the administrator as i am conected as a client on LAN?

List Of Sql Server Instances
Is there a way I can search the local netowkr and get a list of the available sql server instances??

List Of Sql Server In My Network

I want list of Sql Server in my network. i used from ADOMd but i failed.
please help me.

List Databases On A Server
Hey Guys,

Quick question. I'm writing a log on screen for my app at the moment which logs onto SQL servers and databases. I've already written the code where it adds all names of each servers to a combo box using SQLDMO. The thing I need now is to write some code that updates a combobox for the databases available for the server selected above.

Any ideas?


How To List Server Databases
Does anyone have a code sample of how to list installed databases on a server?
I have a list of servers from NetServerEnum that populate a drop down and now want to fill another with databases on that server.


List Of Addresses In Domain From DNS Server?
Is it possible to get a list of addresses in a domain from a DNS server in VB6? Every DNS example I've found so far appear to resolve only one hostname at a time, and shelling an NSLOOKUP.EXE window is too difficult (for me) since the LS command is only available in interactive mode (I was going to redirect output to text file and read it). Any suggestions?


Server Shared Printer List
i want to see the printers in the root of the server

like \exg2003

so it will list all the printers shared on that PC, but i keep getting errors, tried with drive list, dir list and file list, it doesnt like the UNC for some reason, and i do have rights to access it from here. any ideas?

when i get it setup i will just shell what printer they use, because all of our machines have drivers for the things, so they can setup all thier printers by themselves.

List All Files And Folders On Web Server
Is there a way to use the inet control to get a list of all the files and folders in the ftp folder?

List Of Users On Domain/Server

I want to know how to get a list of all the user's on a domain or server.

This is a lil urgent. Please help.

List Databases On MSSQL Server
I can list available servers and tables, but how can I list all databases on a sql server?

Get A List Of Logged Users In Server
Hi there,

Is it possible for me (using API or so) to get a list of all users logged on to the network?

Please help.


Retrieving SQL Server Database List

I want to get access to the list of SQL Server databases that the user currentl has defined on their machine. Its to produce a drop down list like the one you see in Query Analyser. I have tried accessing the registry but I am having a few problems.


James Culshaw

Way To Return A List Of All Databases On MS SQL Server?
Is there a way to return a list/names of every database that is on the MS SQL server?

Know List Database And Table In SQL Server
I use this macro to list in A column of sheet the name of sql server on my lan.
Is possible to "scan server by server" and insert into column B the name of database and related table?
Sub test_sql()
Dim TEST As String
Dim RIGA As String

Set sqlApp = CreateObject("SQLDMO.Application")

Set serverList = sqlApp.ListAvailableSQLServers

numServers = serverList.Count
RIGA = 2

For I = 1 To numServers

TEST = serverList(I)

Range("A" + RIGA) = TEST

Set sqlApp = Nothing

End Sub


List Of Files From Remote FTP Server

I have a function

public Sub ListOfFiles(strIniPath as string)
filter = "*.txt"
End Sub

- that gives me a list of all files that satisfied to the filter.

But I'd like to be able to bring the list of files that are placed on some remote FTP server either.

I'd like to define UserName, Password, Port, all necessary stuff and than to run
ListOfFiles on some strIniPath directory on remote FTP server and to obtain
the list of such files that are matching to the filter.

10x in advance.

List Files On Server With OCX Control
Is there a way to list files from server side with an ActiveX control?

I mean, technically, the control is executed locally, so if I use a dirlistbox, it will be client side, not server side.

What I need to do is a little file manager which would let you get and put files from/to a remote directory (like an FTP client, but put is http upload)..

I can do it with a standard ASP file, but I was looking for a way to do it in VB instead..

Let me know!

Nicolas LeBlanc
Product Manager
Ordiplan Inc.

Server List -&gt; Sent To Client *NOT COMM Question*
Hi All,

I've got this server that sends a string to the client (F.E.: "Administration Room|Admin|Chit Chat|Public|Misc|Public")
Is it possible to, only count the "square" (???) numbers (from the array) and add them to the listbox and if the Array(i), if i = Odd-number than not show the server in the list.

My Code:

Public Function SplitAllTheStuff(strToSplit As String)
Dim MyTempArray() As String
MyTempArray() = Split(strToSplit, "|")
Dim i As Integer
i = 0
For i = 0 to UBound(MyTempArray)
lstServers.AddItem MyArray(i)
Next i
End Function
I thought I could use the STEP function in my For - Next loop, but dont know how to use it
But I also need to save the MyTempArray() with the Ranks needed to log on , so if the Login Button was clicked it only allowed you if your rank is high enough:

Private Sub cmdLoginToServer_Click()
strRank = UCase$(frmLogin.Tag)
If MyTempArray((lstServers.ListIndex * 2) - 1) = strRank Then
Unload Me
End If
End Sub
I thought this should work, but it doesn't


Copyright © 2005-08, All rights reserved