Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

List available SQL Servers using VB.NET

Posted on 2008-09-29
4
Medium Priority
?
2,522 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 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