HotDog's Blog

Hotdog (Robert Verpalen) about C# and vb.net

vbCity Blogs moved to:
http://cs.vbcity.com/blogs
  Home :: Syndication  :: Login

JanFebruary 2010Mar
SMTWTFS
31123456
78910111213
14151617181920
21222324252627
28123456
78910111213

Articles

Archives

Topics

CONTACT

Fun but useful linkies

General

VS 2005

Wolfenstein ET

One of the things that was always an issue (at least for me ;-) ) was to get a list of all sql servers available to the machine the code was run at.

Sure, there was the sqldmo,netserverenum and even a method using odbc, but each needed api calls (or interop). But for those of you interested: great news: whidbey has the requiring of the information build in !!!! :-)
The SqlDataSourceEnumerator gives back a datatable with information on the available servers. (See the link to find out precisely what information)

From .net 2.0 and up, filling a listbox with the server-names can be as simple as:
listBox1.DisplayMember = "ServerName";
listBox1.DataSource = System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources();

posted on Monday, June 06, 2005 3:55 AM