Enumerating SQL Servers from .NET 2.0
Posted by: Julia Lerman Blog - Dont Be Iffy...,
on 29 Jan 2006 |
View original | Bookmarked: 0 time(s)
There's a cool new .net 2.0 feature I didn't know about until I needed to do this
a few days ago. If your application has FullTrust, you can use the System.Data.Sql.SqlDataSourceEnumerator to
get alist of available SQL servers (2000 and 2005 only). The query returns a
DataTable which you can just attach to a combobox or drop down list.
Dim instance As SqlDataSourceEnumerator = SqlDataSourceEnumerator.Instance
Dim dt As DataTable = instance.GetDataSources()
...