edit date/time in sqllite

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
albourgz
Posts: 147
Joined: Wed 06 May 2009 12:17
Location: belgium

edit date/time in sqllite

Post by albourgz » Tue 05 May 2020 15:16

Using c++ builder 10.3.2, VCL, Win 32, Unidac 8.1.2, SQLite.
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);
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:

Code: Select all

UPDATE tsheet_log
SET
  TASK = :TASK,
  COMMENTAIRE = :COMMENTAIRE,
  SUBTASK = :SUBTASK,
  DTSTART = :DTSTART,
  DTSTOP = :DTSTOP
WHERE
  ID = :OLD_ID
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?

MaximG
Devart Team
Posts: 1437
Joined: Mon 06 Jul 2015 11:34

Re: edit date/time in sqllite

Post by MaximG » Mon 18 May 2020 16:34

Thank you for the information, however, it's not enough to reproduce the issue. Please compose and send us a simplest sample, execution of which causes the issue. In addition, we will need the SQLite Database (*.db3). For your convenience, please use the e-support form https://www.devart.com/company/contactform.html

Post Reply