Код: Выделить всё
try
MyQuery1.close;
MyQuery1.SQL.Clear;
MyQuery1.SQL.Text:='INSERT INTO tickets (`seat`, `status`, ) VALUES (:seat, 1)';
MyQuery1.Prepare;
if not MyConnection1.InTransaction then
MyConnection1.StartTransaction;
try
for i := 1 to 795 do begin
MyQuery1.ParamByName('seat').AsString := IntToStr(i);
MyQuery1.Execute;
end;
MyConnection1.Commit;
except
MyConnection1.Rollback;
raise;
end;
except
on E: exception do
showmessage(E.Message);
end;