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
this was the code and this was the Error Message that I getCode:SQLDMO.Application fApp = new SQLDMO.ApplicationClass(); SQLDMO.NameList nl = (SQLDMO.NameList)fApp.ListAvailableSQLServers(); foreach (string strServer in nl) { MessageBox.Show(strServer); }
can ay one help me? thanks alotCode: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)).






Reply With Quote