unit Unit8;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids, DBGrids, Db, DBTables;

type
  Televi = class(TForm)
    DBGrid1: TDBGrid;
    Label1: TLabel;
    DBGrid2: TDBGrid;
    Button1: TButton;
    Label2: TLabel;
    Button2: TButton;
    Query1: TQuery;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  elevi: Televi;

implementation

uses Unit3, Unit1;

{$R *.DFM}

procedure Televi.FormClose(Sender: TObject; var Action: TCloseAction);
begin
mainform.enabled:=true;
end;

procedure Televi.FormShow(Sender: TObject);
begin
mainform.enabled:=false;
end;

procedure Televi.Button1Click(Sender: TObject);
begin
if MessageDlg('Doriti sa stergeti datele despre elevul selectat?',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
query1.Close;
query1.SQL.Text:='delete from "rezult.db" where cod_elev='+inttostr(dm.elevi['cod']);
query1.ExecSQL;
dm.elevi.Delete;
end;
end;

procedure Televi.Button2Click(Sender: TObject);
begin
if MessageDlg('Doriti sa stergeti datele despre toti elevii?',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
   dm.elevi.close;
   dm.elevi.EmptyTable;
   dm.elevi.Active:=true;
   dm.rezult.close;
   dm.rezult.EmptyTable;
   dm.rezult.Active:=true;
  end;
end;

end.
