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:
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.]