|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
enumerating sql servers in sql server 2005Is 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. :-)
-- Show quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA *************************** Think Outside the Box! *************************** "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... > > > Or use new ado.net class SqlDataSourceEnumerator, for example:
foreach (DataRow row in SqlDataSourceEnumerator.Instance.GetDataSources().Rows) { Console.WriteLine(row["ServerName"].ToString()); } -- Show quoteMiha 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... > 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... >> > > 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... >> > > 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? 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... > |
|||||||||||||||||||||||