Home > Back-end >  Delphi
Delphi

Time:10-15

how to solve this problem, very urgent!!!!!!!!!!!!!!!!!!!!
This is the garage management system, the function of this step is to put a list of the data to the backup table, then put this table that records deleted,
Code:
Procedure TForm7. Button1Click (Sender: TObject);
Var m, n, z, t: the variant;
The begin

The begin
ADOquery1. Close;
ADOQuery1. SQL. The Clear;
ADOQuery1. SQL. The Add (' select ID, if used, models, enter the time from chewei the where plate=: k ');
ADOQuery1. The parameters. Parambyname (' k '). The value:=form7. Label5. Caption;
ADOQuery1. Open;
M:=form7. ADOQuery1. FieldByName (' ID '.) AsString;
N:=form7. ADOQuery1. FieldByName (' whether or not to use '). AsString;
Z:=form7. ADOQuery1. FieldByName (' models'). AsString;
T:=form7. ADOQuery1. FieldByName (' in time '). The value;
end;
The begin
Adoquery2. Close;
Adoquery2. SQL. The Clear;
Adoquery2. SQL. The Add (' insert into cars values (ID=: a, license plate=: b, whether or not to use=: c, models=: d, enter the time=: e, leave time=: f, expenses=: g) ');
Adoquery2. The Parameters. ParamByName (' a '). The Value:=m;
Adoquery2. The Parameters. ParamByName (' b '). The Value:=form7. Label5. Caption;
Adoquery2. The Parameters. ParamByName (' c '). The Value:=n;
Adoquery2. The Parameters. ParamByName (' d '). The Value:=z;
Adoquery2. The Parameters. ParamByName (' e '). The Value:=t;
Adoquery2. The Parameters. ParamByName (' f '). The Value:=form7. Label7. Caption;
Adoquery2. The Parameters. ParamByName (" g "). The Value:=form7. Label8. Caption;
Adoquery2. ExecSQL;
end;

The begin
Adoquery1. Close;
Adoquery1. SQL. The Clear;
Adoquery1. SQL. The Add (' update chewei set plate=: ba, whether to use=: ca, models=: da, enter the time=: ea, leave time=: fa, expenses=: ga where ID=: aa ');
Adoquery1. The Parameters. ParamByName (' aa '). The Value:=m;
Adoquery1. The Parameters. ParamByName (" ba "). The Value:=' ';
Adoquery1. The Parameters. ParamByName (" ca "). The Value:='no';
Adoquery1. The Parameters. ParamByName (' da '). The Value:=' ';
Adoquery1. The Parameters. ParamByName (" ea "). The Value:=' ';
Adoquery1. The Parameters. ParamByName (' fa '). The Value:=' ';
Adoquery1. The Parameters. ParamByName (' ga) Value:=' ';
Adoquery1. ExecSQL;
end;
Form7. Close;
Form14. Edit5. Text:=';
Form14. Edit7. Text:=';
Form14. Edit8. Text:=';
end;

CodePudding user response:

ADOquery1 ADOCONNECTION connection string setting right,
Other DELPHI block without the BEGIN... END