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.
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.
Adoquery1.Fields.Clear; ///////注意加这句Adoquery1.Close;
...
Adoquery1.Open;
错误提示:
Project Project1.exe raised exception class EDatebaseError with message 'ADOQuery1:Field '' not found'.Process stoped.Use Step or Run to continue.
adoquery1.SQL.text:='select max(FDateTime) as FDateTime from ALARMHS';
adoquery1.Open;
怎么没看到你程序中操作FSystem,但怎么报他的错捏?
MaxDate:String;adoquery1.SQL.Clear;
adoquery1.SQL.Add('select max(FDateTime) as FDateTime from ALARMHS');
adoquery1.Open;
MaxDate:=adoquery1.filed[0].value; //这样试试看.
看有没有问题
要不用另外一个没有添加静态字段的adoquery