[Lazarus] Microsft Access Date Select statment

Werner Pamler werner.pamler at freenet.de
Sat Mar 25 00:38:52 CET 2023


Am 24.03.2023 um 21:48 schrieb Larry Dalton via lazarus:
> No matter how I format the beginning and ending dates, it doesn't 
> work. If I format the dates in quoted strings ('20230101') or any 
> variation, I get the incompatible types errors.

Enclose the date/time by '#', put the date parts in year/month/day order 
and separate them by slashes:

     Query.SQL.Add('SELECT * FROM Events WHERE (StartTime >= 
#2019/01/15#) AND (StartTime < #2019/01/16#)');

But using query parameters is always the better way.



More information about the lazarus mailing list