用下面的方法初始化ADO连接时 
s:='Provider=SQLOLEDB.1;Password="'+c+'";Persist Security Info=True;UserID='+b+';Initial Catalog='+d+';Data Source='+a+'';
  ADOConnection1.connected:=False;
  ADOConnection1.Connectionstring:=''+s+'';
  ADOConnection1.connected:=True;
如果连接时出错,用什么信号可以来判断有错误出现?我想用它来弹出提示框

解决方案 »

  1.   

    begin
    s:='Provider=SQLOLEDB.1;Password="'+c+'";Persist Security Info=True;UserID='+b+';Initial Catalog='+d+';Data Source='+a+'';
      ADOConnection1.connected:=False;
      ADOConnection1.Connectionstring:= s;
      try
        ADOConnection1.connected:=True;
      except
        on E: Exception do ShowMessage(E.Message);
      end;
    end;
      

  2.   

    on E: Exception do ShowMessage(E.Message);
    是什么意思啊?
      

  3.   

    begin
    s:='Provider=SQLOLEDB.1;Password="'+c+'";Persist Security Info=True;UserID='+b+';Initial Catalog='+d+';Data Source='+a+'';
      ADOConnection1.connected:=False;
      ADOConnection1.Connectionstring:= s;
      try
        ADOConnection1.connected:=True;
      except
        on E: Exception do 
         E.Create('数据库连接错误');   
      end;
    end;
      
      

  4.   

    ADOConnection1.ConnectionString :=DBConnectionString ;
        try      
           ADOConnection1.Connected :=true;
        except
          showmessage('数据库连接错误');
        end;