How to use the ListAvailableSqlServers in c#

06/11/2004 - 04:24 por Anonimo | Informe spam
Here is my code:

///////////////////////////////////////////////////////////////////////////
SQLDMO._Application SqlServer = new ApplicationClass();
try
{

SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i));

}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}



///////////////////////////////////////////////////////////////////////////
The compiler tell me : Queryinterface is failed of the SQLDMO.NameList

What shall I do ?
 

Leer las respuestas

#1 José Miguel Torres
08/11/2004 - 12:50 | Informe spam
Hi, try

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i).ToString());



and look this link http://www.csharphelp.com/archives2...ve342.html

regards


José Miguel Torres
jtorres_diaz~~ARROBA~~terra.es
http://jmtorres.blogspot.com
escribió en el mensaje
news:#zpIf$
Here is my code:




///////////////////////////////////////////////////////////////////////////
SQLDMO._Application SqlServer = new ApplicationClass();
try
{

SQLDMO.NameList servers = SqlServer.ListAvailableSQLServers();

for(int i=0;i<servers.Count;i++)
MessageBox.Show(servers.Item(i));

}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}






///////////////////////////////////////////////////////////////////////////
The compiler tell me : Queryinterface is failed of the SQLDMO.NameList

What shall I do ?





Preguntas similares