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);
}
}