[2.0] List of SQL Srevers
well, i try to get the sql server list on my network
getting the names of the servers using c#
and here is what i done:
i added a refrance to use SQLDMO
here is the code i used to get the servers list
Code:
SQLDMO.Application fApp = new SQLDMO.ApplicationClass();
SQLDMO.NameList nl = (SQLDMO.NameList)fApp.ListAvailableSQLServers();
foreach (string strServer in nl)
{
MessageBox.Show(strServer);
}
this was the code and this was the Error Message that I get
Code:
Unable to cast COM object of type 'System.__ComObject' to interface
type 'SQLDMO.NameList'. This operation failed because the QueryInterface
call on the COM component for the interface with IID '{10022406-E260-11CF-
AE68-00AA004A34D5}' failed due to the following error: No such interface
supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
can ay one help me? thanks alot
Re: [2.0] List of SQL Srevers
Re: [2.0] List of SQL Srevers
Re: [2.0] List of SQL Srevers
well, danasegarane i really looked at this link befor you send it, and i used its code, and it gives me the same error message
thanks mendhak i will see your page
Re: [2.0] List of SQL Srevers
still giving me the same old error
Re: [2.0] List of SQL Srevers
Could you try this on another machine? It might be a COM registration issue or some OS components missing. Or try uploading sample code here, we can try.