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

Development Resources Download Files for Programmer and Administrators

Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.

download files List SQL Server Instances using .Net Framework SqlDataSourceEnumerator class

File Details
Downloads: 13655 File Size: 64.6kB
Posted By: eralper Views: 17025
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.

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 - 2020 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems