Solved

List available SQL Servers using VB.NET

Posted on 2008-09-29
4
2,489 Views
Last Modified: 2013-11-08
I am looking for a reliable way to search for all available SQL Servers on a network.   I then need to be able to list the databases for a particular server.  I have done this in the past in VB6 applications using SQLDMO without problem.  I am wondering if their is a better or different way to do this using VB.NET and the .NET Framework version 3.5
0
Comment
Question by:Mike_Stevens
  • 3
4 Comments
 
LVL 11

Expert Comment

by:ladarling
ID: 22598850
Try:
Dim dtSQL As New DataTable
dtSQL = Sql.SqlDataSourceEnumerator.Instance.GetDataSources
DataGridView1.DataSource = dtSQL.AsDataView
 
This should query your network for all available instances of SQL server 2000 or 2005.
0
 
LVL 11

Accepted Solution

by:
ladarling earned 500 total points
ID: 22599064
0
 

Author Comment

by:Mike_Stevens
ID: 22599136
I tried the second methid you just posted.  It works but it is very, very slow
0
 
LVL 11

Expert Comment

by:ladarling
ID: 22599277
How big is your network, out of curiousity? The server enum takes about 10 seconds for me, but we only have around 200 workcenters.
Using the first method, you will just get the SQL server names available. Once you 'weed out' the non-server machines, you can then run the stored procedure 'sp_databases' against the servers to enumerate the db's.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
asp.net mvc5 3 37
Get String split 5 32
How to Get total minutes between two hours 4 26
XML & .net 5 18
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now