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
| unit U_transfert;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, DBGridEh, dxCore, dxButtons, TFlatGaugeUnit, StdCtrls,
TFlatHintUnit;
type
TF_Transfert = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox4: TGroupBox;
annuler: TdxButton;
valider: TdxButton;
DBGridEh1: TDBGridEh;
FlatHint1: TFlatHint;
GroupBox3: TGroupBox;
FlatGauge1: TFlatGauge;
procedure annulerClick(Sender: TObject);
procedure validerClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
F_Transfert: TF_Transfert;
implementation
uses U_module;
{$R *.DFM}
procedure TF_Transfert.annulerClick(Sender: TObject);
begin
try
application.Terminate;
except
showmessage('Erreur à la fermeture de l''application');
end;
end;
procedure TF_Transfert.validerClick(Sender: TObject);
begin
if MessageDlg('Voulez-vous effectivement effectuer le transfert....?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
With Data.T_Dbase do
begin
Data.T_Mysql.open;
open;
self.FlatGauge1.MinValue:=0;
self.FlatGauge1.MaxValue:=recordcount;
First;
self.FlatGauge1.Progress:=1;
While not (eof) do
begin
Data.T_Mysql.Insert;
Data.T_Mysql.fieldbyname('code_etab').asstring:=Data.T_Dbase.FieldByName('annee').AsString;
Data.T_Mysql.fieldbyname('lib_etab').AsString:=Data.T_Dbase.FieldByName('N_esa').AsString;
Data.T_Mysql.post;
next;
self.FlatGauge1.Progress:=self.FlatGauge1.Progress+1;
end;
end;
// Data.Q_Mysql.Post;
showmessage('Transfert vers la base MySql bien effectué');
end;
// fin de proc
end;
end. |
Partager