Last active
December 16, 2016 17:39
-
-
Save dimka11/90d050df3170523b48839ae878ba33e1 to your computer and use it in GitHub Desktop.
Удаление строки из таблицы
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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