473,618 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Available SQL Server list

Is there a way to access a list of available sql servers in vb and make a dropdown list?
Nov 20 '05 #1
7 2034
You need to import SQLDMO in your project. The following function adds the
list of servers to a combo box - cboServers and returns the count:

Imports SQLDMO

.....

Private Function LoadSQLServerLi st() As Integer
Dim serverIndex As Integer
Dim sqlServers As SQLDMO.NameList
Dim sqlServer As Object

' Get a list of servers
sqlServers = New SQLDMO.Applicat ion().ListAvail ableSQLServers( )

' Iterate through the server names, and add it to the combobox
For Each sqlServer In sqlServers
If Not sqlServer Is Nothing Then
cboServers.Item s.Add(sqlServer )
End If
Next

' Send back the count of servers
LoadSQLServerLi st = cboServers.Item s.Count
End Function

Hope that helps.

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"EvanK" <an*******@disc ussions.microso ft.com> wrote in message
news:F6******** *************** ***********@mic rosoft.com...
Is there a way to access a list of available sql servers in vb and make a

dropdown list?
Nov 20 '05 #2
Got it.
Nov 20 '05 #3
Additionally, is there any doc on SQLDemo that you know of?
Nov 20 '05 #4
Great - it worked fine - thanks. Now is there a way to list the databases?
Nov 20 '05 #5
You could create a method/routine that would return the results of:

SELECT Name FROM sysdatabases ORDER BY <your choice, Name, ID>

and fill another combobox with it..or listbox...or wheva!

HTH
-Rich

"EvanK" <an*******@disc ussions.microso ft.com> wrote in message
news:81******** *************** ***********@mic rosoft.com...
Great - it worked fine - thanks. Now is there a way to list the

databases?
Nov 20 '05 #6
Oops....make sure you hit the Master database

SELECT Name FROM Master..sysdata bases
"EvanK" <an*******@disc ussions.microso ft.com> wrote in message
news:81******** *************** ***********@mic rosoft.com...
Great - it worked fine - thanks. Now is there a way to list the

databases?
Nov 20 '05 #7
Continuing the previous example:

Dim sqlServer As SQLDMO.SQLServe r
Dim sqlDB As Object

sqlServer = New SQLDMO.SQLServe r()
Try
' Connect to your database with userID and password
sqlServer.Conne ct(cboServers.T ext, txtUserID.Text,
txtPassword.Tex t)

' Check for database names in the server
' This loop adds the database name to another combobox
For Each sqlDB In sqlServer.Datab ases
If Not sqlDB.Name Is Nothing Then
cboDatabases.It ems.Add(sqlDB.n ame)
End If
Next
Catch Exp As Exception
MsgBox(Exp.ToSt ring)
End Try
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"EvanK" <an*******@disc ussions.microso ft.com> wrote in message
news:81******** *************** ***********@mic rosoft.com...
Great - it worked fine - thanks. Now is there a way to list the

databases?
Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1753
by: Chad Lupkes | last post by:
Hi everyone, I am looking for a way to determine for myself what scripts are available to use on a particular server. It has been suggested to me that I should "see if I can find an ASP that will list the Com Objects available to ASP" So, does anyone know where I can find the code for an ASP page that will bring up a list of the COM objects available on a server? -- Chad Lupkes chadlupkes@yahoo.com http://www.chadlupkes.com/ (Under...
1
3083
by: Tony Archer | last post by:
I am trying to build a site for a group which already has a hosting company. I would like to try to find out which objects are available for use to me. I do not have admin access to the NT box. Obviously I have permissions in my area of the server. I know I can test for specific objects but I'd like to know what is available, not just what I can test against. Is this even possible? The server is running Server 2000.
0
1543
by: Nikki Locke | last post by:
Archive-name: C++-faq/libraries/part1 Comp-lang-c++-archive-name: C++-faq/libraries/part1 Available C++ Libraries FAQ =========================== Introduction ~~~~~~~~~~~~ Dos and don'ts - (Mostly don'ts)
6
6500
by: Valerian John | last post by:
I have a ListBox webcontrol on an aspx page. Items are added to the ListBox using client-side code. However, when the page is posted back the items are missing/not available. (It is like the page does not know the items were added client-side.) TIA, Val
8
328
by: EvanK | last post by:
Is there a way to access a list of available sql servers in vb and make a dropdown list?
4
2500
by: comp.lang.php | last post by:
I wrote my own version of memory_get_usage() if that function is not available: if (!function_exists('memory_get_usage')) { /** * Determine the amount of memory you are allowed to have * * @access public * @return long
0
1932
by: mandarkraftware | last post by:
Hi All, Let me present you with list of consultants currently available. Name / Job Title Summary Ramchandran/Java · 7+ years experience in the field of Software Development. · Expertise in full Software Development Life Cycle (SDLC)
1
1788
by: Sachin | last post by:
Hi All, Let me present you with list of consultants currently available. Name / Job Title Summary Ramchandran/Java · 7+ years experience in the field of Software Development. · Expertise in full Software Development Life Cycle (SDLC)
2
2726
by: querry | last post by:
Hi all, I am trying to get a list of all the available sql servers and then populate them in a combo box. I do this with the following code taken from http://www.csharphelp.com/archives2/archive342.html SQLDMO.Application sqlApp = new SQLDMO.ApplicationClass(); SQLDMO.NameList sqlServers = sqlApp.ListAvailableSQLServers(); for (int i = 0; i < sqlServers.Count; i++) ...
0
8212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8595
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8304
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8455
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7126
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5552
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2587
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.