enumerating sql servers in sql server 2005

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Is there anyway new in SQL Server 2005 to enumerate all the servers on the
network without sqldmo? I'm working in .NET and want to get the list, im
doing it now in sqldmo and it works fine, but would like to do it with
managed code instead of using a com object...
 
smo. It is the new dmo. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Or use new ado.net class SqlDataSourceEnumerator, for example:
foreach (DataRow row in
SqlDataSourceEnumerator.Instance.GetDataSources().Rows)

{

Console.WriteLine(row["ServerName"].ToString());

}
 
thanks a lot!

Miha Markic said:
Or use new ado.net class SqlDataSourceEnumerator, for example:
foreach (DataRow row in
SqlDataSourceEnumerator.Instance.GetDataSources().Rows)

{

Console.WriteLine(row["ServerName"].ToString());

}


--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Brian Henry said:
Is there anyway new in SQL Server 2005 to enumerate all the servers on
the network without sqldmo? I'm working in .NET and want to get the list,
im doing it now in sqldmo and it works fine, but would like to do it with
managed code instead of using a com object...
 
do you happen to know a way to list all the databases on a selected server
also with out having to log into it? SQLDMO let you do this before



Miha Markic said:
Or use new ado.net class SqlDataSourceEnumerator, for example:
foreach (DataRow row in
SqlDataSourceEnumerator.Instance.GetDataSources().Rows)

{

Console.WriteLine(row["ServerName"].ToString());

}


--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Brian Henry said:
Is there anyway new in SQL Server 2005 to enumerate all the servers on
the network without sqldmo? I'm working in .NET and want to get the list,
im doing it now in sqldmo and it works fine, but would like to do it with
managed code instead of using a com object...
 
whoops i made a mistake i didnt mean not logging in... in SQLDMO i'd do this

Dim oSQLServer As New SQLDMO.SQLServer

oSQLServer.LoginSecure = True

oSQLServer.Connect(s_Server)

Me.cboDatabaseList.Items.Clear()

For Each db As SQLDMO.Database In oSQLServer.Databases

If Not db.SystemObject Then



Dim dbName As String = db.name

Me.cboDatabaseList.Items.Add(dbName)

End If

End If

End If

End If

Next



how would you do that now without sqldmo?
 
Back
Top