Available SQL Servers on Network 
Author Message
 Available SQL Servers on Network

Anyone have some working code using C# and SQL-DMO to find
the available SQL Servers on a network?

I could do this quite easily with VB but cant get it to
work with C# which I am just starting out with.

Cheers,
MrMcauber



Sun, 31 Oct 2004 18:56:10 GMT  
 Available SQL Servers on Network
MrMcauber,

    If you add a reference to the SQLDMO library to your project, then all
the objects should be available to you and you should be able to use the
same calls you did in VB (although not the same code).  Just go to the "Add
References" dialog and look at the "COM" tab.

    Hope this helps.

--
               - Nicholas Paldino [.NET MVP]


Quote:
> Anyone have some working code using C# and SQL-DMO to find
> the available SQL Servers on a network?

> I could do this quite easily with VB but cant get it to
> work with C# which I am just starting out with.

> Cheers,
> MrMcauber



Sun, 31 Oct 2004 20:24:08 GMT  
 Available SQL Servers on Network
Nicholas

I try it as follow:

SQLDMO.Application app = new SQLDMO.ApplicationClass();
int count = (app.ListAvailableSQLServers()).count;

QueryInterface for interface SQLDMO.NameList failed.

What is wrong? Have you a sample?

David



Quote:
> MrMcauber,

>     If you add a reference to the SQLDMO library to your project, then all
> the objects should be available to you and you should be able to use the
> same calls you did in VB (although not the same code).  Just go to the
"Add
> References" dialog and look at the "COM" tab.

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET MVP]



> > Anyone have some working code using C# and SQL-DMO to find
> > the available SQL Servers on a network?

> > I could do this quite easily with VB but cant get it to
> > work with C# which I am just starting out with.

> > Cheers,
> > MrMcauber



Mon, 01 Nov 2004 14:27:43 GMT  
 Available SQL Servers on Network
David,

Thats exactly what I get too, no matter how I jiggle
things about.

rather frustrating,

Mrmcauber

Quote:
>-----Original Message-----
>Nicholas

>I try it as follow:

>SQLDMO.Application app = new SQLDMO.ApplicationClass();
>int count = (app.ListAvailableSQLServers()).count;

>QueryInterface for interface SQLDMO.NameList failed.

>What is wrong? Have you a sample?

>David

>"Nicholas Paldino [.NET/C# MVP]"


Quote:

>> MrMcauber,

>>     If you add a reference to the SQLDMO library to

your project, then all
Quote:
>> the objects should be available to you and you should
be able to use the
>> same calls you did in VB (although not the same code).  
Just go to the
>"Add
>> References" dialog and look at the "COM" tab.

>>     Hope this helps.

>> --
>>                - Nicholas Paldino [.NET MVP]


message

>> > Anyone have some working code using C# and SQL-DMO to
find
>> > the available SQL Servers on a network?

>> > I could do this quite easily with VB but cant get it
to
>> > work with C# which I am just starting out with.

>> > Cheers,
>> > MrMcauber

>.



Tue, 02 Nov 2004 01:01:58 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Getting available SQL Servers/Oracle Databases

2. Check if SQL Server is available

3. Open Error When SQL Server not available

4. Client Server problem: CLIENT printerDC not available on SERVER

5. Perform SQL statement in VC++ against MS SQL Server 7.0

6. SQL Syntax on SQL Server

7. Q:Use DISTINCT in SQL statement with OLE DB for SQL Server

8. SQL Server with CDatabase/CRecordset and server cursors

9. Win2k Adv. Server + Sql Server 7

10. Sending info from server to client in SQL Server

11. CRecordset and SQL Server Linked Server View

12. How do you run a SQL Server sql script file against a SQL Server database?

 

 
Powered by phpBB® Forum Software