[SOLVED]Unable to search SQLite3 database records in time period lazarus / 16-Databases ---------------------------------------------------------------------- SNPI · 2020-02-21 07:38 Hi guys!I want to search the records in a certain period of time on a date,but the following error message appears during searching operation. Can anyone help me to modify the SQL code?Thanks in advance to all! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);beginSQLQuery1.close;SQLQuery1.SQ L.Clear;SQLQuery1.SQL.Add('select * from DATA where Date='''+Dateedit1.Text+'''and Time>='''+Timeedit1.Text+'''Time<='''+t imeedit2.Text+''''); SQLQuery1.ExecSQL; SQLQuery1.Open;end; ---------------------------------------------------------------------- Zvoni · 2020-02-21 08:00 Nevermind, that you: 1) should use Parameters 2) should not use Keywords as Column-Names 3) use ExecSQL on a Query which returns Datasets 4) shouldn't separate Date and Time in separate columns 5) Pretty sure there is more...... On first look you're missing a blank  in front of your "and Time" ---------------------------------------------------------------------- SNPI · 2020-02-21 08:17 Quote from: Zvoni on February 21, 2020, 09:00:11 amNevermind, that you: 1) should use Parameters 2) should not use Keywords as Column-Names 3) use ExecSQL on a Query which returns Datasets 4) shouldn't separate Date and Time in separate columns 5) Pretty sure there is more...... On first look you're missing a blank  in front of your "and Time" I did miss two blank.Zvoni,thanks a lot! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SQLQuery1.SQL.Add('select * from DATA where Date='''+Dateedit1.Text+''' and Time>='''+Timeedit1.Text+''' and Time<='''+timeedit2.Text+''''); ---------------------------------------------------------------------- af0815 · 2020-02-21 10:28 If you use Parameters the SQl will more readable and safer. You must only change the params and can leave the sql untouched.