when i use .AsDateTime get error "cannot access field as type DateTime"
here my code :
Code: Select all
FConnection_SQLITE.Database := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + 'smart_sfa.db3';
FConnection_SQLITE.Connect;
FQueryUniv.Close;
FQueryUniv.SQL.Text := 'select max(tgl) as tgl, nm_hari from tblclosing left outer join tblhari on (strftime(''%w'', tblclosing.tgl)+1 = tblhari.kd_hari)';
FQueryUniv.Open;
if FQueryUniv.RecordCount <= 0 then
begin
raise Exception.Create('Tanggal transaksi di table closing kosong');
end;
ShowMessage(FQueryUniv.FieldByName('tgl').AsString);
ShowMessage(DateToStr(FQueryUniv.FieldByName('tgl').AsDateTime)); /// <======== error here
Delphi XE5
UNIDAC 6.1.3
Windows 8.1
file test
http://www.filedropper.com/zzzz