Bonjour à tous,
J'ai une base de donnée Interbase qui contient la table C_OPERATION. Cette table contient un champ SOMME, je voudrais en calculer la somme totale .
voici mon codeDésolé pour cette question triviale, mais je galère dessus depuis plusieurs jours.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 procedure TForm1.Button2Click(Sender: TObject); var TOTAL: currency; begin TOT:=0; Form1.IBQuery1.Close; Form1.IBQuery1.SQL.Clear; Form1.IBQuery1.Sql.Add('SELECT SUM(SOMME) as TOT_SOMME FROM C_OPERATION WHERE ID_COMPTE=:ID_Cpte'); Form3.IBQuery1.Params.ParamByName('ID_Cpte').Value := ID_Compte_Affiche; // Id du compte affiché Form1.IBQuery1.Open; Je voudrais récupérer la somme TOT_SOMME et l'affecter à ma variable TOTAL end;
Merci de vos réponses
Jean-Louis
Partager