1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| SQLQuery1->Active=false;
SQLQuery1->SQL->Clear();
AnsiString sql("SELECT * FROM historique");
SQLQuery1->SQL->Add(sql);
int Resultat= SQLQuery1->RecordCount;
SQLQuery1->Open();
ShowMessage(Resultat);
if (Resultat > 0) // Si Resultat est > 0 alors c'est quil y a au moins une reference
{
SQLQuery1->Active=false;
SQLQuery1->SQL->Clear();
AnsiString sql("SELECT RefProduit,Marque,Model,COUNT(Quantite) AS qte FROM historique GROUP BY RefProduit ORDER BY qte DESC");
SQLQuery1->SQL->Add(sql);
SQLQuery1->Open();
int check = SQLQuery1->RecordCount;
ShowMessage(check);
for (int i = 0; i < check; i++)
{etc//
{ |