edit date/time in sqllite
Posted: Tue 05 May 2020 15:16
Using c++ builder 10.3.2, VCL, Win 32, Unidac 8.1.2, SQLite.
I created a table:
I made a few inserts using queries, it works.
Now I want to edit the table, using a TCRDBGrid, TUniDataSource and a TUniQuery. Fields were correctly added and recognized as datetimeFields. Updatequery generated seems fine:
Problem: if I type a wrong date format, I get an error message (this is normal). If I type a right date, it seems fine, but when clicking update, my dates are replaced by 30/12/1899 00:00:00. The other fields are updated correctly.
Setting a breakpoint in BeforePost event shows <field>->AsDateTime is filled in correctly with what I typed, but component seems unable to write it.
I tried to force dateformat property of the field to dd/mm/yyyy hh:nn:ss, no change.
I hope I can do something so the dateDime fields are updated correctly?
I created a table:
Code: Select all
create table TSHEET_LOG (id integer primary key autoincrement not null, dtstart datetime, dtstop datetime, task nvarchar(30), subtask nvarchar(30), commentaire nvarchar(40));
create index idx_dt_tsheet on TSHEET_LOG (dtstart, dtstop);
Now I want to edit the table, using a TCRDBGrid, TUniDataSource and a TUniQuery. Fields were correctly added and recognized as datetimeFields. Updatequery generated seems fine:
Code: Select all
UPDATE tsheet_log
SET
TASK = :TASK,
COMMENTAIRE = :COMMENTAIRE,
SUBTASK = :SUBTASK,
DTSTART = :DTSTART,
DTSTOP = :DTSTOP
WHERE
ID = :OLD_ID
Setting a breakpoint in BeforePost event shows <field>->AsDateTime is filled in correctly with what I typed, but component seems unable to write it.
I tried to force dateformat property of the field to dd/mm/yyyy hh:nn:ss, no change.
I hope I can do something so the dateDime fields are updated correctly?