pvaju896
pvaju896

Reputation: 1417

how to retrieve the names of servers that i can connect to..?

my system is connected Trhough LAN..

totally four systems connected. and all systems having MS SQl server installed in it.

now i need to retreive that - which all server's i can connect to..?

server names - for connection string...!!

thanx'

Upvotes: 0

Views: 109

Answers (2)

user333306
user333306

Reputation:

SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();

Check this open source project for more: http://dataconnectionsuite.codeplex.com/

Upvotes: 1

Martin Smith
Martin Smith

Reputation: 453847

You can use SMO for this. Example here http://www.sqldbatips.com/showarticle.asp?ID=45

Or System.Data.Sql.SqlDataSourceEnumerator

Upvotes: 1

Related Questions