TDateTime and Access MDB

Forum related to ADO

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Dali
Junior Boarder
Junior Boarder
Posts: 30
Joined: 08.02.2010, 14:36

TDateTime and Access MDB

Post by Dali »

Hello!

Sorry for bringing this back to life but I'd like to know if there is a solution.

I'm facing exactly this issue, now closed because it was related to a previous beta version of the Zeos components:

http://zeoslib.sourceforge.net/viewtopi ... =33&t=3596

Example:

Code: Select all

zquery.fieldByName('CREATION_TIME').asDateTime := now;
showmessage(formatdatetime('yyyy/mm/dd hh:mm:ss', now));
showmessage(formatdatetime('yyyy/mm/dd hh:mm:ss', zquery.fieldByName('CREATION_TIME').asDateTime));
The first message shows a correct date and time, for instance '2015/03/24 14:22:31'.

However, the second one returns only the date part and not the time (asDateTime is storing and returning only integers and not doubles as it should): '2015/03/24 00:00'.

This is happening with Zeos v7.2, Lazarus v1.5, FPC 3.1, all of them from SVN. With Delphi 6 and native ADO components it works against the same MDB database (tested using the same app but compiled before it was ported to Lazarus+Zeos, I don't have the original sources anymore and I wouldn't like to go back to that environment either).
Dali
Junior Boarder
Junior Boarder
Posts: 30
Joined: 08.02.2010, 14:36

Re: TDateTime and Access MDB

Post by Dali »

Another thread, this one even older, depicting the same situation:

http://zeoslib.sourceforge.net/viewtopi ... 18&p=13439

This solution of changing ZDBCADOUtils in this way:

Code: Select all

function ConvertAdoToSqlType(FieldType: SmallInt): TZSQLType;
begin
  case FieldType of
  ...
    adDate : Result := stTimestamp; // stDate; <--- DOESN'T WORK AS EXPECTED
  ...
... Does the trick for me, because I don't need connections in design time for this project.
Post Reply