adoquery1.SQL.Clear;
   adoquery1.SQL.Add('select max(FDateTime) as FDateTime from ALARMHS');
   adoquery1.Open;
注:FDateTime是我SQL数据库中的时间格式的字段,另外还有FSystem,FZone,FDetail三个是char类型
我想用上述语句在我的SQL2000中FDateTime列选出最大时间,放进我的变量maxDate.
现在老是出现错误.
错误如下:
Project Project1.exe raised exception class EDatebaseError with message 'ADOQuery1:Field 'FSystem' not found'.Process stoped.Use Step or Run to continue.

解决方案 »

  1.   


    Adoquery1.Fields.Clear; ///////注意加这句Adoquery1.Close;
    ...
    Adoquery1.Open;
      

  2.   

    不行,还是有错!!!!
    错误提示:
    Project Project1.exe raised exception class EDatebaseError with message 'ADOQuery1:Field '' not found'.Process stoped.Use Step or Run to continue.
      

  3.   

    那就先手动把那几个FSystem,FZone,FDetail全部删除.
      

  4.   

    adoquery1.close;
       adoquery1.SQL.text:='select max(FDateTime) as FDateTime from ALARMHS';
       adoquery1.Open;
    怎么没看到你程序中操作FSystem,但怎么报他的错捏?
      

  5.   

    var
      MaxDate:String;adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select max(FDateTime) as FDateTime from ALARMHS');
    adoquery1.Open;
    MaxDate:=adoquery1.filed[0].value;   //这样试试看.
      

  6.   

    你直接在查询管理器里执行select max(FDateTime) as FDateTime from ALARMHS
    看有没有问题
      

  7.   

    删了adoquery1的静态字段 FSystem
    要不用另外一个没有添加静态字段的adoquery