cs_carpiste
Messages postés13Date d'inscriptionvendredi 23 avril 2004StatutMembreDernière intervention 7 octobre 2012
-
5 sept. 2005 à 18:23
coucou747
Messages postés12303Date d'inscriptionmardi 10 février 2004StatutMembreDernière intervention30 juillet 2012
-
10 sept. 2005 à 18:27
Je repose ma question, voici le code écrit, peut on l'optimiser
Langage DELPHI7
Base de données : Access
qpay.Active:=false;
qpay.SQL.Clear;
qpay.SQL.Add('SELECT * FROM Papaye ');
qpay.SQL.Add(' WHERE Salarie = '+quotedstr(Presal)+' ');
qpay.SQL.Add(' AND Papaye.Rubrique = '+inttostr(qrub.fieldbyname('Code').asinteger)+' ');
qpay.Active:=true;
if qpay.RecordCount > 0 then
begin
qecr.Active:=false;
qecr.SQL.Clear;
qecr.SQL.Add('UPDATE Papaye SET ');
qecr.SQL.Add(' Libelle = '+quotedstr(qrub.fieldbyname('Libelle_Long').asstring)+' ');
qecr.SQL.Add(' WHERE Salarie = '+quotedstr(Presal)+' ');
qecr.SQL.Add(' AND Papaye.Rubrique = '+inttostr(qrub.fieldbyname('Code').asinteger)+' ');
qecr.SQL.Add(' AND Papaye.Date_D = cdate('+quotedstr(datetostr(datdeb))+') ');
qecr.ExecSQL;
qecr.Active:=false;
end
else
begin
qecr.Active:=false;
qecr.SQL.Clear;
qecr.SQL.Add('INSERT INTO Papaye (Salarie,Rubrique,Montant,Libelle,Date_D,Date_F,Coef,Base) ');
qecr.SQL.Add('VALUES ('+quotedstr(Presal)+','+inttostr(qrub.fieldbyname('Code').asinteger)+', ');
qecr.SQL.Add(''+floattostrf(0.00,Fffixed,10,2)+','+quotedstr(qrub.fieldbyname('Libelle_Long').asstring)+', ');
qecr.SQL.Add('cdate('+quotedstr(datetostr(datdeb))+'),'+quotedstr(datetostr(datfin))+'),');
qecr.SQL.Add(''+floattostrf(0.00,Fffixed,10,2)+',sum(0.00) ),'+floattostrf(0.00,Fffixed,10,2)+' ');
qecr.ExecSQL;
qecr.Active:=false;
end;
qpay.Active:=false;