if dmData.ADOConnectionGB2004.Connected then对这个语句在运行时为什么会有 dmData.ADOConnectionGB2004.Connected =inaccessible value????

解决方案 »

  1.   

    非Delphi的First Class对象可能是这样的
      

  2.   

    TdmData = class(TDataModule)
        ADOConnectionGB2004: TADOConnection;
        ADOQuery1 : TADOQuery;
        ADOQuery2 : TADOQuery;
    .
    .
    .
    function TdmData.ExecSQL(QueryNO:integer;sSQL: String;IsQuery:Boolean): integer;
    var
      CurrentQuery:TADOQuery;
    begin
      result := DM_EXECSQLERROR;
      try
      case QueryNO of
        1:
           CurrentQuery := ADOQuery1;
        2:
           CurrentQuery := ADOQuery2;
        else
          exit;
      end;
    .
    .
    .
    end;在执行 CurrentQuery := ADOQuery1; 这一句的时候就出错了。也不知道是什么回事。
     if dmData.ADOConnectionGB2004.Connected  then 
    也是出错,为什么
      

  3.   

    project newGbmain.exe raised exception class Eaccessviolation
    with message 'Access violation at address 0053796B' in module
    'NewGBMain.exe'.read of address '00000058'.process stop.use step or run to continue都是和这类式的,是不是我没有异常处理。怎么写?