1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, DBCtrls, Grids, DBGrids, Db, DBTables, StdCtrls;
type
TFichSt = class(TForm)
DSst: TDataSource;
Tbst: TTable;
DBGst: TDBGrid;
DBNavst: TDBNavigator;
Labst: TLabel; // sous titre dans la fiche
private
{ Déclarations privées }
public
{ Déclarations publiques }
procedure TbSup(NomTab, TitreFic : string);
procedure TbModif(NomTab, TitreFic : string);
end;
var
FichSt: TFichSt;
implementation
{$R *.DFM}
procedure TFichSt.TbSup(NomTab, TitreFic : string); // suppression d'un enregistrement
begin
Tbst.TableName := NomTab;
Caption := TitreFic; // titre de la fiche
TbSt.Active := False;
TbSt.ReadOnly := False;
LabSt.Caption := 'SUPPRESSION d''une LIGNE';
DBNavSt.VisibleButtons := [nbFirst,nbPrior,nbNext,nbLast,nbDelete,
nbCancel,nbPost];
TbSt.Active := True;
TbSt.Last;
ShowModal;
DBGst.Enabled := True;
end;
procedure TFichSt.TbModif(NomTab, TitreFic : string); // modification
begin
Tbst.TableName := NomTab;
Caption := TitreFic;
TbSt.Active := False;
TbSt.ReadOnly := False;
try
LabSt.Caption := 'MODIFICATION d''une LIGNE';
DBNavSt.VisibleButtons := [nbFirst,nbPrior,nbNext,nbLast,nbEdit,
nbCancel,nbPost];
TbSt.Active := True;
TbSt.Last;
ShowModal;
finally
DBGst.Enabled := True;
TbSt.ReadOnly := True;
TbSt.Close;
Tbst.TableName := '';
end;
end;
End. |
Partager