Page 1 of 1
Convert ADO SQL to Zeos using SQLite
Posted: 05.11.2020, 14:51
by kbboykin
What is the best way to convert this query from ado to zeos. I am using Delphi 2010 and SQLite.
Code: Select all
select * from course where startdate >= now order by startdate
Re: Convert ADO SQL to Zeos using SQLite
Posted: 06.11.2020, 15:05
by marsupilami
Hello,
generally the SQL statements stay the same. There may be differences, when it comes to parameters. I seem to remember that the Delphi ADO components don't support named parameters. So the implementation probably looks like this:
Code: Select all
ZeosQuery.Close;
ZeosQuery.SQL.Text := 'select * from course where startdate >= now order by startdate';
ZeosQuery.Open;
If you you want to feed "now" to the query as a parameter, it could look something like this:
Code: Select all
ZeosQuery.Close;
ZeosQuery.SQL.Text := 'select * from course where startdate >= :MyParamStartDate order by startdate';
ZeosQuery.ParamByName('MyParamStartDate').AsDateTime := Date;
ZeosQuery.Open;
Note: This code is liable to break in one way or another - sqlite has no support for dates, id I remember correctly.
Best regards,
Jan