Problème avec TQUERY et QUICKREPORT
Bonjour,
J'ai un problème quand on génère un bon de commande via QuickReport.
J'ai testé ma requête via PHPMyAdmin et j'obtiens le bon résultat :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
SELECT boncomporte.refbon, bon.datelivraison, bon.communication, bon.refclient, client.NOMCLIENT, boncomporte.refarticle, boncomporte.quantite, articlegeneral.NOMARTICLE_FR, articlegeneral.NOMARTICLE_NL, articlegeneral.UNITEARTICLE, client.ADR1CLIENT, client.CPCLIENT, client.VILLECLIENT, client.CODEPAYS, client.PAYSCLIENT, client.TVACLIENT
FROM (
(
boncomporte
INNER JOIN bon ON boncomporte.refbon = bon.refbon
)
INNER JOIN CLIENT ON bon.refclient = client.REFCLIENT
)
INNER JOIN articlegeneral ON boncomporte.refarticle = articlegeneral.REFARTICLEGEN
WHERE boncomporte.refbon = '2707' |
Voici mon code du TQUERY dans l'événement BeforePrint :
Code:
1 2 3 4 5 6 7 8
|
Query1->SQL->Clear() ;
Query1->SQL->Add("SELECT boncomporte.refbon, bon.datelivraison, bon.communication, bon.refclient, client.NOMCLIENT, boncomporte.refarticle, boncomporte.quantite, articlegeneral.NOMARTICLE_FR, articlegeneral.NOMARTICLE_NL, articlegeneral.UNITEARTICLE, client.ADR1CLIENT, client.CPCLIENT, client.VILLECLIENT, client.CODEPAYS, client.PAYSCLIENT, client.TVACLIENT") ;
Query1->SQL->Add("FROM ((boncomporte INNER JOIN bon ON boncomporte.refbon = bon.refbon) INNER JOIN client ON bon.refclient = client.REFCLIENT) INNER JOIN articlegeneral ON boncomporte.refarticle = articlegeneral.REFARTICLEGEN") ;
Query1->SQL->Add("WHERE bon.refbon = :refbon ");
Query1->ParamByName("refbon")->AsString = FBonCommande->Edit3->Text;
Query1->Prepare();
Query1->Open(); |
Le problème est qu'il m'affiche tous les articles compris dans tous les bons de commande, et non les articles d'un bon de commande spécifique (ici référencé par Edit3->Text !
Borland ne prend pas du tout en compte de la clause "where bon.refbon = :refbon ");
Quelq'un aurait-il une idée ?