HotDog's Blog

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

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

OctNovember 2009Dec
SMTWTFS
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

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