I would like to pass the date in the format DD.MM.YYYY as a parameter to ZQuery.
Where and how do I have to set the format for the date?
I've tried the source code ...
GetFormatSettings;
FormatSettings.ShortDateFormat:='dd.mm.yyyy';
... but in unit "ZSysUtils" in function
TryPCharToDate(P: PAnsiChar; Len: Cardinal; const FormatSettings: TZFormatSettings; var Date: TZDate): Boolean;
FormatSettings.DateFormat stayed at "YYYYMMDD"
OR
QU.SQL.Text:='set language "german"';
QU.ExecSql;
without effect :-(
Norbert
Dateformat for ZQuery.Params
Re: Dateformat for ZQuery.Params
Why not using .AsDateTime?
SQLQuery.SQL.Text := 'UPDATE mytable SET datefield = :pDateTime';
SQLQuery.ParamByName('pDateTime').AsDateTime := Now;
SQLQuery.ExecSQL;
Gets rid of all date conversion hassle.
Edit:
I think what you are looking for are parameters of the connection. Check ZPropertiesEditor.pas or set the parameters design time:
DateReadFormat, DatetimeReadFormat, DatetimeWriteFormat, DateWriteFormat, TimeReadFormat, TimeWriteFormat
SQLQuery.SQL.Text := 'UPDATE mytable SET datefield = :pDateTime';
SQLQuery.ParamByName('pDateTime').AsDateTime := Now;
SQLQuery.ExecSQL;
Gets rid of all date conversion hassle.
Edit:
I think what you are looking for are parameters of the connection. Check ZPropertiesEditor.pas or set the parameters design time:
DateReadFormat, DatetimeReadFormat, DatetimeWriteFormat, DateWriteFormat, TimeReadFormat, TimeWriteFormat
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Dateformat for ZQuery.Params
oh yes the properties on the Zconn
sometimes you need food for thought
OK, thanks
Norbert
sometimes you need food for thought
OK, thanks
Norbert