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
| procedure TDataModule1.ConnecterTicket(sNumSerie : string);
var
AliasInfo : TStringList;
iRecommencer : integer ;
begin
if(Table1.Active = true)then
Table1.Active := false ;
if(Session1.IsAlias('MonAliasTicket'))then
Session.DeleteAlias('MonAliasTicket');
AliasInfo := TStringList.Create;
AliasInfo.Add('USER NAME=SYSDBA');
AliasInfo.Add('SERVER NAME='+gsCheminTicket);
Session1.AddAlias('MonAliasTicket','PARADOX',AliasInfo);
Table1.TableName := TFileName(gsCheminTicket);
Table1.Filter := '[' + gsNomChampNumSerie + ']' + ' = ''' + sNumSerie + '''' ;
iRecommencer := 0 ;
while ((iRecommencer < giNombreTentativesAcces) AND (iRecommencer>=0)) do begin
try
Table1.Active := true ;
iRecommencer := -1 ;
except on E : exception do begin
Session1.Active := false ;
sleep(giDelayEntreDeuxTentatives);
inc(iRecommencer);
end;
end;
end;
if(iRecommencer>=giNombreTentativesAcces)then begin
ShowMessage('CDTT.dll : ConnecterTicket : Impossible d''accéder à la table "'+gsCheminTicket+'"');
DeConnecterTicket();
end;
AliasInfo.Free;
end; |
Partager