Hi
Here are somme elements
Yes, I use SQL_db components
Lazarus 3.4
FPC 3.2.2
Os Client Windows 11 10.0.22631
Os Server Linux Debian 12.4
Mysql 8.0.36
and now the code which causes a "MySQL syntax error" error message:
DataModule1.SQLQuery1.SQL.Add('INSERT INTO ehistocreaop (IdEvt,IdItem,Date, Heure, Domaine, User, Profil, Table) VALUES (:Chp1i, :Chp2i, :Chp3d, :Chp4t, :Chp5s, :Chp6s, :Chp7s, :Chp8s); ');
DataModule1.SQLQuery1.ParamByName('Chp1i').AsInteger := NoNewHistOp;
DataModule1.SQLQuery1.ParamByName('Chp2i').AsInteger := NoNewOp;
DataModule1.SQLQuery1.ParamByName('Chp3d').AsDate := Date;
DataModule1.SQLQuery1.ParamByName('Chp4t').AsString := FormatDateTime('hh:nn:ss', Time);
DataModule1.SQLQuery1.ParamByName('Chp5s').AsString := 'DGFIP';
DataModule1.SQLQuery1.ParamByName('Chp6s').AsString := UserEnCours;
DataModule1.SQLQuery1.ParamByName('Chp7s').AsString := '0';
DataModule1.SQLQuery1.ParamByName('Chp8s').AsString := 'operations';
I only show this part of the code because this is where the error occurs, on the ParamByName('Chp8s').AsString
The proof is that the following code works without error:
DataModule1.SQLQuery1.SQL.Add('INSERT INTO ehistocreaop (IdEvt,IdItem,Date, Heure, Domaine, User, Profil) VALUES (:Chp1i, :Chp2i, :Chp3d, :Chp4t, :Chp5s, :Chp6s, :Chp7s); ');
DataModule1.SQLQuery1.ParamByName('Chp1i').AsInteger := NoNewHistOp;
DataModule1.SQLQuery1.ParamByName('Chp2i').AsInteger := NoNewOp;
DataModule1.SQLQuery1.ParamByName('Chp3d').AsDate := Date;
DataModule1.SQLQuery1.ParamByName('Chp4t').AsString := FormatDateTime('hh:nn:ss', Time);
DataModule1.SQLQuery1.ParamByName('Chp5s').AsString := 'DGFIP';
DataModule1.SQLQuery1.ParamByName('Chp6s').AsString := UserEnCours;
DataModule1.SQLQuery1.ParamByName('Chp7s').AsString := '0';
//DataModule1.SQLQuery1.ParamByName('Chp8s').AsString := 'operations';
You see ? The others ParamByName('Chpxx').AsString pass without problem while the syntax used is the same for ParamByName('Chp8s').AsString.
Of course I checked the table: Fields Profile and Table are both Varchar(15); other parameters (Null authorized, etc...) are the same for both, too.
It's 20h30 in France, I don't have time to try the suggested solutions and won't be able to do so until Wednesday. I'll keep you up-to-date !