Home All Groups Group Topic Archive Search About

enumerating sql servers in sql server 2005

Author
22 Dec 2005 8:50 PM
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...

Author
22 Dec 2005 10:34 PM
Cowboy (Gregory A. Beamer) - MVP
smo. It is the new dmo. :-)

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

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


Show quote
"Brian Henry" wrote:

> 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...
>
>
>
Author
22 Dec 2005 10:42 PM
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());

}


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

Show quote
"Brian Henry" <nospam@nospam.com> wrote in message
news:%23ttiTlzBGHA.3840@TK2MSFTNGP15.phx.gbl...
> 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...
>
Author
23 Dec 2005 3:28 PM
Brian Henry
thanks a lot!

Show quote
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%23DEvJk0BGHA.2840@TK2MSFTNGP12.phx.gbl...
> 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" <nospam@nospam.com> wrote in message
> news:%23ttiTlzBGHA.3840@TK2MSFTNGP15.phx.gbl...
>> 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...
>>
>
>
Author
23 Dec 2005 3:39 PM
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



Show quote
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%23DEvJk0BGHA.2840@TK2MSFTNGP12.phx.gbl...
> 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" <nospam@nospam.com> wrote in message
> news:%23ttiTlzBGHA.3840@TK2MSFTNGP15.phx.gbl...
>> 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...
>>
>
>
Author
23 Dec 2005 3:47 PM
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?
Author
25 Dec 2005 5:15 AM
Sahil Malik [MVP C#]
Here is how - http://blogs.msdn.com/sushilc/archive/2004/10/14/242395.aspx

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
__________________________________________________________
Show quote
"Brian Henry" <nospam@nospam.com> wrote in message
news:%23ttiTlzBGHA.3840@TK2MSFTNGP15.phx.gbl...
> 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...
>

AddThis Social Bookmark Button