How Can I retreive all the SQL server on my LAN ?

  • Thread starter Thread starter { Olivier }
  • Start date Start date
O

{ Olivier }

Hello from FRANCE

I use VS 2005 beta 2 and Sql server 2005.

How Can I retreive all the SQL server on my LAN ?

Thanks
Olivier
 
Hi,

The simpliest way:
Add reference to COM object SQLDMO and use this code:
SQLDMO.Application app = new SQLDMO.Application();
SQLDMO.NameList list = app.ListAvailableSQLServers();
foreach (string name in list)
{
// your servers
}
 
Or, without calling into a COM component, the framework exposes The
DbDataSourceEnumeratorclass. The example in help shows how to use it.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Miha Markic said:
Hi,

The simpliest way:
Add reference to COM object SQLDMO and use this code:
SQLDMO.Application app = new SQLDMO.Application();
SQLDMO.NameList list = app.ListAvailableSQLServers();
foreach (string name in list)
{
// your servers
}

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

{ Olivier } said:
Hello from FRANCE

I use VS 2005 beta 2 and Sql server 2005.

How Can I retreive all the SQL server on my LAN ?

Thanks
Olivier
 
Yes, that's even better. :-)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

William (Bill) Vaughn said:
Or, without calling into a COM component, the framework exposes The
DbDataSourceEnumeratorclass. The example in help shows how to use it.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

Miha Markic said:
Hi,

The simpliest way:
Add reference to COM object SQLDMO and use this code:
SQLDMO.Application app = new SQLDMO.Application();
SQLDMO.NameList list = app.ListAvailableSQLServers();
foreach (string name in list)
{
// your servers
}

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

{ Olivier } said:
Hello from FRANCE

I use VS 2005 beta 2 and Sql server 2005.

How Can I retreive all the SQL server on my LAN ?

Thanks
Olivier
 
:-(

It's in C# ?

Can somewhone translate it in VB please ?

thanks

Olivier



Miha Markic said:
Yes, that's even better. :-)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

William (Bill) Vaughn said:
Or, without calling into a COM component, the framework exposes The
DbDataSourceEnumeratorclass. The example in help shows how to use it.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

Miha Markic said:
Hi,

The simpliest way:
Add reference to COM object SQLDMO and use this code:
SQLDMO.Application app = new SQLDMO.Application();
SQLDMO.NameList list = app.ListAvailableSQLServers();
foreach (string name in list)
{
// your servers
}

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Hello from FRANCE

I use VS 2005 beta 2 and Sql server 2005.

How Can I retreive all the SQL server on my LAN ?

Thanks
Olivier
 
Of course. As a VB.NET fan, I find that frustrating as well, but I've had to
learn to translate to VB from C#. There are several translators available on
the web--just google C# to VB.NET...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

{ Olivier } said:
:-(

It's in C# ?

Can somewhone translate it in VB please ?

thanks

Olivier



Miha Markic said:
Yes, that's even better. :-)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

William (Bill) Vaughn said:
Or, without calling into a COM component, the framework exposes The
DbDataSourceEnumeratorclass. The example in help shows how to use it.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi,

The simpliest way:
Add reference to COM object SQLDMO and use this code:
SQLDMO.Application app = new SQLDMO.Application();
SQLDMO.NameList list =
app.ListAvailableSQLServers();
foreach (string name in list)
{
// your servers
}

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Hello from FRANCE

I use VS 2005 beta 2 and Sql server 2005.

How Can I retreive all the SQL server on my LAN ?

Thanks
Olivier
 
Back
Top