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 74 75 76 77 78 79 80 81
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBTables, DB;
type
TForme = class(TForm)
ButtonPrincipal: TButton;
ButtonSecondaire: TButton;
MtCartoP: TTable;
dsCartoP: TDataSource;
BatchMove1: TBatchMove;
MtCartoPProv: TTable;
DataSource4: TDataSource;
procedure ButtonPrincipalClick (Sender: TObject);
procedure ButtonSecondaireClick (Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Forme: TForme;
nomTable:TTable;
procedure CopierTable(); forward;
implementation
{$R *.dfm}
procedure TForme. ButtonPrincipalClick (Sender: TObject);
begin
MtCartoP.Active:=false;
MtCartoP.TableName:='MtCartoP';
MtCartoP.Active:=True;
nomTable := TTable.Create(self);
nomTable.TableType :=ttParadox;
MtCartoPProv.Active:=false;
nomTable.TableName :='MtCartoPProv';
BatchMove1.Source :=MtCartoP;
BatchMove1.Destination :=nomTable;
BatchMove1.Mode :=batCopy;
BatchMove1.Execute;
nomTable.AddIndex('','Cle Interne',[IxPrimary]);
nomTable.AddIndex('CartoPProvCodepNtrNdrv','CodDepart;NumTroncon;NumDerivat',[]);
MtCartoPProv.Active:=True;
end;
procedure CopierTable();
begin
{
with Forme do
begin
MtCartoP.Active:=false;
MtCartoP.TableName:='MtCartoP';
MtCartoP.Active:=True;
nomTable := TTable.Create(self);
nomTable.TableType :=ttParadox;
MtCartoPProv.Active:=false;
nomTable.TableName :='MtCartoPProv';
BatchMove1.Source :=MtCartoP;
BatchMove1.Destination :=nomTable;
BatchMove1.Mode :=batCopy;
BatchMove1.Execute;
nomTable.AddIndex('','Cle Interne',[IxPrimary]);
nomTable.AddIndex('CartoPProvCodepNtrNdrv','CodDepart;NumTroncon;NumDerivat',[]);
MtCartoPProv.Active:=True;
end;
}
end;
procedure TForme. ButtonSecondaireClick (Sender: TObject);
begin
CopierTable();
end;
end. |
Partager