The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: Enumerate the ALL SQL Server Instances in Network
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Stephen LackeyPosted Jul 1, 2014, 4:05 PM
using System;using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.Sql; namespace MatrixSQLServers { public partial class Form1 : Form { DataTable dt; public Form1() { InitializeComponent(); dt = SqlDataSourceEnumerator.Instance.GetDataSources(); comboBox1.Items.Clear(); foreach (DataRow dr in dt.Rows) { if (!comboBox1.Items.Contains(dr[0].ToString())) { comboBox1.Items.Add(dr[0].ToString()); } } } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { dataGridView1.DataSource = dt.Select("ServerName = '" + comboBox1.SelectedItem.ToString() + "'").CopyToDataTable(); } } }