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
|
program Gmrpmr;
{$APPTYPE CONSOLE}
uses
SysUtils,
connecu in 'connecu.pas' {DataModulepmr: TDataModule};
var
Fgmr:TextFile; //fichier reçu de GMR
chaineconnec,lignelu, typeligne : string;
procedure cas00(ligne:string);
begin
datamodulepmr:=TDataModulepmr.Create(nil);
with DataModulepmr.ADOConnectionPMR do begin
// Open;
if Connected then begin
writeln('ça passe');
DataModulepmr.ADOTableFichier.Insert;
DataModulepmr.ADOTableFichierC_ficHorodate.AsString := copy(ligne,6,14);
DataModulepmr.ADOTableFichier.Post;
end
else
writeln('ça passe pas');
end;
end;
procedure cas01(ligne:string);
begin
writeln('suite');
end;
begin
try
{ TODO -oUser -cConsole Main : Insert code here }
AssignFile(Fgmr,'c:\test.txt'); //initialisation : où se trouve le fichier reçu
Reset(Fgmr); // ouverture du fichier
while not Eof(Fgmr) do
begin
Readln(Fgmr,lignelu);
typeligne := Copy(lignelu,0,2);
if typeligne='00'then
cas00(lignelu);
if typeligne='01' then
cas01(lignelu);
readln;
closeFile(Fgmr); // fermeture du fichier
end;
except
on E:Exception do
Writeln(E.Classname, ': ', E.Message);
end;
end. |
Partager