I need to add extra data to my TEMP table shown at the bottom on button click.
I need all existing occurences of FROM - TO - DAYS in the table duplicated and inserted.
RATE_PRICE would be predetermined & and the same for all new inserts (when inserting).
and also inserted.
Example : I have an extra bed to add and it costs 15 euros. Now I would like to, when I check a checkbox (and click on a button) to insert that value (15) in the TEMP table but it must follow the displayed dates values in the grid. I had in mind adding extra field in the TEMP table called EXTRA which would be invisible unless checkbox checked. So when I check an option of adding an extra bed, the extra bed would follow the displayed.Rate price would be 15 then ... dates.
How can I insert desired data ?
UPDATE
I did it on button click :
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
with ABSQuery4 do begin
ABSQuery4.Close;
ABSQuery4.SQL.Clear;
ABSQuery4.SQL.Text := 'INSERT INTO TEMP (extra,Date_From,Date_To,Rate_price,Days,Total) VALUES (:a1,:a2,:a3,:a4,:a5,:a6)';
ABSquery4.Params.ParamByName('a1').asString :='TT';
ABSquery4.Params.ParamByName('a2').value := cxDateEdit1.date;
ABSquery4.Params.ParamByName('a3').value := cxDateEdit2.date;
ABSquery4.Params.ParamByName('a4').value :='1';
ABSquery4.Params.ParamByName('a5').value :=Daysbetween(cxDateEdit1.Date,cxDateEdit2.Date);
ABSquery4.Params.ParamByName('a6').value := (ABSquery4.Params.ParamByName('a4').value)*(ABSquery4.Params.ParamByName('a5').value);
ABSquery4.ExecSQL ;
ABSquery2.Refresh;
end;
end;
Any more elegant way ?