SQLDMO away return NULL

  • Thread starter Thread starter Dean L. Howen
  • Start date Start date
D

Dean L. Howen

I tries to search for SQL server using SQLDMO, but it alway return null
although I have updated SQL to sp3

Please tell me more.
 
Dean L. Howen said:
I tries to search for SQL server using SQLDMO, but it alway return null
although I have updated SQL to sp3

Please tell me more.

Show some code.

/Fredrik
 
These line of codes are what I have done. Please help me to check them.
I think they are correct, because they perform correctly when I connect to
another computer, but I've not found what the problems are.
Thanks
------------------------------------------------------------------------
private void findSqlServ()
{
try
{
SQLDMO.Application sqlApp = new SQLDMO.ApplicationClass();

SQLDMO.NameList sqlNamelst = sqlApp.ListAvailableSQLServers();

this.cboServer.Items.Clear();

for (int i=1; i<=sqlNamelst.Count; i++ )
{
object srv = sqlNamelst.Item(i);

if ( srv != null )
{
this.cboServer.Items.Add(srv);
}
}

if ( sqlNamelst.Count == 0 )
{
this.cboServer.Text = strNull;
}
else
{
this.cboServer.SelectedIndex = 0;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
 
Back
Top