Search code examples
sqlitedelphizeos

Incompatible Types: TZDate and TDateTime in Delphi 2010


I am trying to backport an app from Delphi CE 10.4 to Delphi 2010. I am trying to use ZeosLib (8.0.0 stable) for the first time to connect to the SQLite database used with Delphi 10.4 CE, but keep getting this error:

Incompatible Types: TZDate and TDateTime

All other fields work without issue.

I have tried to google this issue, but cannot find any suggestions or help. I have searched the ZeosLib Forum and no help there, either.

I want to convert a string to date, and used the standard:

DHTData.vitalsvdate.Value :=  StrToDate(edDate.text);

Is there a conversion I need to be doing/using with ZeosLib?


Solution

  • I found the way to make this work. You have to include ZSysUtils, ZVariant, ZClasses, ZCompatibility in the uses section;

    Then declare in variables part of the code:

     var
        ZDate :TZDate;
      begin
        Zdate :=  DHTData.bloodsugargdate.Value; //the value of edDate.text
        case button of
        ...
        //This "DHTData.vitalsvdate.Value :=  StrToDate(edDate.text);" becomes
        ...
        DHTData.vitalsvdate.Value :=  ZDate;  
      end
    

    Source: Backporting App to Delphi 10.4: Encountering 'IncompatibleTypes: TZDate TDateTime' with ZeosLib