F
Faraz Rasheed
I am getting the InvalidCastException with the
message 'QueryInterface for interface SQLDMO.NameList
failed' when i try to access the ListAvailableSQLServers()
method of SQLDMO.Application class
SQLDMO.Application objSQLDMOApp = new
SQLDMO.ApplicationClass();
// populating the combo box with available servers
SQLDMO.NameList servers =
objSQLDMOApp.ListAvailableSQLServers();
for(int i=0; i<servers.Count; i++)
{
cbxServer.Items.Add(servers.Item(i));
cbxServer.SelectedIndex = 0;
}
What is the problem in the code?
message 'QueryInterface for interface SQLDMO.NameList
failed' when i try to access the ListAvailableSQLServers()
method of SQLDMO.Application class
SQLDMO.Application objSQLDMOApp = new
SQLDMO.ApplicationClass();
// populating the combo box with available servers
SQLDMO.NameList servers =
objSQLDMOApp.ListAvailableSQLServers();
for(int i=0; i<servers.Count; i++)
{
cbxServer.Items.Add(servers.Item(i));
cbxServer.SelectedIndex = 0;
}
What is the problem in the code?