[SOLVED] SQLite SQL error lazarus / 16-Databases ---------------------------------------------------------------------- dodgebros · 2022-03-21 15:09 Hi all, I get this error with the following code: SQLiteConnection1: near 'INSERT': syntax error 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 DataModule1.SQLQry_RptData.SQL.Add('INSERT INTO rpt_data (colx, coly, info) VALUES (:colx, :coly, :info)');DataModule1.SQLQry_RptData.Params .ParamByName('colx').AsString:= 'X';DataModule1.SQLQry_RptData.Params.ParamByName('coly').AsString:= 'Y';DataModule1.SQLQry_RptData.Params.ParamByName('info').AsString:= 'test info';DataModule1.SQLQry_RptData.ExecSQL;DataModule1.SQLTransact ion1.Commit;  What am I doing wrong? TD ---------------------------------------------------------------------- Zvoni · 2022-03-21 15:27 Don't use the Add-Method. Clear the SQL.Text beforehand and assign directly to SQL.Text ---------------------------------------------------------------------- dodgebros · 2022-03-21 19:07 That solved the problem, thank you very much! TD ---------------------------------------------------------------------- paweld · 2022-03-22 07:53 Why not? Just remember to clear SQL 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.Clear;SQLQuery1.SQL.Add(' ... '); ---------------------------------------------------------------------- Zvoni · 2022-03-22 08:03 Quote from: paweld on March 22, 2022, 08:53:19 amWhy not? Just remember to clear SQL 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.Clear;SQLQuery1.SQL.Add(' ... ');pawel, yeah, but it's the reason i rather use the Text-Property than the Add- Method. If i "forget" to "clear" the SQL, then it still gets its job done The SQL-Property is a TStrings: https://www.freepascal.org/docs- html/rtl/classes/tstrings.text.html QuoteWhen this property is set, the string will be cut into smaller strings, based on the positions of end-of-line markers in the string. Any previous content of the stringlist will be lost.