if ADOConnection1.Active then { TODO : 试试 }

解决方案 »

  1.   

    if ADOConnection1.Connected then
      

  2.   

    好象都不行
    ADOConnection1.Active 没这个方法
    ADOConnection1.Connected 就是adoconnection.connected=true
    在没赋值前肯定为flase
      

  3.   

    如果按照karl(多功能算术逻辑运算单元)的方法是可以简单的实现但是是利用系统返回的错误信息,因为连接失败adoconnection.connected自然为flase现在需要能捕捉系统的错误信息自己返回一个结果,请问该如何去做???
      

  4.   

    property Errors: Errors;DescriptionUse Errors to get direct access to the ADO Errors Collection for the ADO Connection object the TADOConnection component represents. This direct access reference allows an application to use properties and methods of the underlying Errors Collection object. Accessing the underlying connection object is especially useful for utilizing properties and methods of the Errors Collection not surfaced in TADOConnection.The Errors Collection object of a Connection object contains the errors generated by the provider. For each provider error, one or more ADO Error objects are placed in the Errors Collection. Error objects represent individual errors from the provider and are not ADO-specific. On a subsequent error, the Errors Collection is cleared of any Error objects and new Error objects are inserted for the current error.Note: Use of Errors to directly access the underlying ADO Errors Collection object requires a good working knowledge of ADO objects in general and ADO Errors Collection objects in specific. Using the Errors Collection object directly is not recommended unless you are familiar with connection object operations. Consult the Microsoft Data Store SDK help for specific information on using ADO Errors Collection objects.
      

  5.   

    先用ADOConnection1.Open方法连接
    后用ADOConnection1.Connected属性判断是否连接成功
      

  6.   

    用异常可以处理,这样:
    ......//接上面的
    try
      DataModule3.ADOConnection1.Connected:=true;
    except
      form2.Close;
    end;
      

  7.   

    try
      
     ...
    except
      ShowMessage('Error!');
    end;