Skip to content

Instantly share code, notes, and snippets.

@dimka11
Last active December 16, 2016 17:39
Show Gist options
  • Save dimka11/90d050df3170523b48839ae878ba33e1 to your computer and use it in GitHub Desktop.
Save dimka11/90d050df3170523b48839ae878ba33e1 to your computer and use it in GitHub Desktop.
Удаление строки из таблицы
procedure TForm1.BitBtn3Click(Sender: TObject);
var
id: Integer;
sqlTextStore: string;
begin
if Application.MessageBox('Удалить?','',MB_YESNO)=IDYES then
begin
case PageControl1.ActivePageIndex of
0: ADOQuery1.Delete;
1: ADOQuery2.Delete;
2: ADOQuery3.Delete;
3: begin
id := ADOQuery4.Fields[0].AsInteger;
sqlTextStore := ADOQuery4.SQL.Text;
ADOQuery4.Active := False;
ADOQuery4.SQL.Clear;
ADOQuery4.SQL.Add('DELETE FROM Заказы WHERE id_заказ = '+IntToStr(id));
ADOQuery4.ExecSQL;
ADOQuery4.Active := False;
ADOQuery4.SQL.Clear;
ADOQuery4.SQL.Text := sqlTextStore;
ADOQuery4.Active := True;
SetDBGrid;
end;
4: begin
id := ADOQueryBin.Fields[0].AsInteger;
sqlTextStore := ADOQueryBin.SQL.Text;
ADOQueryBin.Active := False;
ADOQueryBin.SQL.Clear;
ADOQueryBin.SQL.Add('DELETE FROM Корзина WHERE id_заказ = '+IntToStr(id));
ADOQueryBin.ExecSQL;
ADOQueryBin.Active := False;
ADOQueryBin.SQL.Clear;
ADOQueryBin.SQL.Text := sqlTextStore;
ADOQueryBin.Active := True;
SetDBGrid;
end;
end;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment