SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software

Kodyaz Development Resources Download Files for Programmer and Administrators

Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.

List SQL Server Instances using .Net Framework SqlDataSourceEnumerator class

File Details
Downloads: 12564 File Size: 64.6kB
Posted By: eralper Views: 15670
Date Added: 28 Sep 2007
You can list both SQL Server 2000 and SQL Server 2005 database instances within a network using this sample application code. The sample application uses the SqlDataSourceEnumerator class which is introduced with .Net Framework 2.0 to enumerate existing SQL Server instances. The sample Windows Forms application uses the Sql.SqlDataSourceEnumerator.Instance.GetDataSources() method to get a DataTable object instance populated with Microsoft SQL Server instances installed within the current network area. And as seen in the sample, you can populate and fill a DataGridView object or populate a ComboBox object with retrieved values about SQL Server instances.
Comments
 

CarlosMAg said:

Greatest, Simple and Usefull... Thanks...!!!!
25 Oct 2007 2:53 PM
 

Peter said:

I have created something similar to yours except I used DbProviderFactory. I run yours and mine on a Windows XP Professional 64bit machine which has 2 instances: mymachine\SQLExpress (Express Edition) and MSSQLSERVER (Developer Edition (64bit)) SQL Browser Service: not running SQLInstance and my own coding: returned MSSQLSERVER SQL Browser Service: running SQLInstance and my own coding: returned mymachine\SQLEXPRESS Do you have any idea why it won't return both instances? Thanks, Peter
18 Dec 2007 5:11 PM
Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems