Solved

List available SQL Servers using VB.NET

Posted on 2008-09-29
4
2,512 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 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

Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

632 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