enumerating sql servers in sql server 2005

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...
 
G

Guest

smo. It is the new dmo. :)

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

***************************
Think Outside the Box!
***************************
 
M

Miha Markic [MVP C#]

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

{

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

}
 
B

Brian Henry

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...
 
B

Brian Henry

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...
 
B

Brian Henry

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top