Insert with ZQuery Zeos Access (SOLVED) lazarus / 16-Databases ---------------------------------------------------------------------- Ame555 · 2020-10-24 22:00 Hello community, I'm trying to understand how to do Insert and MySQL with ZQuery and Zeos Access in lazarus, I'm connected to a table that only has two fields "idnumber" auto increment and "number" integer, I added a TEdit in which is placed the number to insert and also I put a TButton that when pressing makes the insert, looking for examples I found this code: 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 TfrmPrueba.Button1Click(Sender: TObject);begin  if ZQuery1.Active then    ZQuery1.Close;    with ZQuery1.SQL do     begin       Clear;     ZQuery1.Insert;       ZQuery1.FieldByName('numero').AsInteger:=StrToInt(Edit1.Text);     end;ZQuery1.Open;end; As those who know about this have already realized that this code is giving an error, the SQL query to do this directly is "insert into numbers (number) values (2);" but I did not find a clear example of how to accommodate this query and I will appreciate your help in this. I am not very good with English so I apologize for that. Greetings. [Edited to add code tags - please see How to use the Forum.] ---------------------------------------------------------------------- miab3 · 2020-10-26 11:18 If the SQL looks like this: 'select * from table' then procedure TfrmPrueba.Button1Click(Sender: TObject); begin      ZQuery1.Active:=true;      ZQuery1.Insert;      ZQuery1.FieldByName('numero').AsInteger:=StrToInt(Edit1.Text);      ZQuery1.Post; end;  Michał ---------------------------------------------------------------------- Ame555 · 2020-10-28 01:03 Thank you very much it works well, I realized that it does not help much to have a data saved in the table if at least you do not know when it was saved and what name it has, then I added to my table the datetime fields of type "datetime" and name of type "varchar", for it I modified the code. 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);begin  ZQuery1.Active:=true;     ZQuery1.Insert;     ZQuery1.FieldByName('numero').AsInteger:=StrToInt(Edit1.Text);     ZQuery1.FieldByName('fecha').AsDateTime:=now();     ZQuery1.FieldByName('nombre').AsString:=Edit1.Name;     ZQuery1.Post;end;   When compiling and executing it does not give any error but when checking the table it only saves the numerical value introduced by TEdit1. Best regards. ---------------------------------------------------------------------- GAN · 2020-10-28 03:09 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);begin     ZQuery1.Open;  //    ZQuery.Active:=true it's the same     ZQuery1.Insert;     ZQuery1.FieldByName('numero').AsInteger:=StrToInt(Edit1.Text);     ZQuery1.FieldByName('fecha').AsDateTime:=Now;                //now();     ZQuery1.FieldByName('nombre').AsString:=Edit1.Name;  // Error     ZQuery1.Post;end; ---------------------------------------------------------------------- Ame555 · 2020-10-29 23:29 Thank you very much it works very well, thank you miab3 and GAN without your help I would still be lost.