Page 1 of 1

AutoRefresh doesn't works as expected

Posted: Mon 15 Dec 2008 09:20
by swierzbicki
Hi,

When setting autorefresh to true, MyDAC generate a "bad" sql statement.
Here is the SQL Statement (TMyQuery.SQL) :

Code: Select all

Select distinct
planning.*,
affaires.IdTypeCommande,
affaires.poseht,
vrp.idagence,
vrp.iddepot,
ecrituresouvertes.MontantOuvertTTC,
receptionmarchandise.DateReception
from
  planning
  LEFT OUTER JOIN ecrituresouvertes on (ecrituresouvertes.idaffairefe2000 = planning.idaffairefe2000 and ecrituresouvertes.typeDocument  '')
  LEFT OUTER JOIN receptionmarchandise on (receptionmarchandise.idaffairefe2000 = planning.idaffairefe2000)
  INNER JOIN clientssia on (clientssia.idclientsia = planning.idclientsia)
  INNER JOIN `vrp` ON (`clientssia`.`IdVRP` = `vrp`.`IdVRP`)
  INNER JOIN perimetressia ON (vrp.idAgence like perimetressia.IdAgence And perimetressia.Utilisateur like :prUtilisateur)
  LEFT OUTER JOIN planningintervenants ON (planning.IdPlanning = planningintervenants.IdPlanning)
--  LEFT OUTER JOIN matricule ON (planningintervenants.IdMatricule = matricule.IdMatricule)
--  LEFT OUTER JOIN soustraitants ON (planningintervenants.idSoustraitant = soustraitants.idSoustraitant)
  LEFT OUTER JOIN affaires on (affaires.idaffairefe2000 = planning.idaffairefe2000)
Where
fin >= Date_Sub(curdate(), Interval 2 month)
and
( planning.IdIntervention  0 and planning.idStadePlanning  0)
and ( affaires.edi = 0 )

When autorefresh is set to true, MyDac generate this SQL Statement :

Code: Select all

SELECT IdPlanning FROM planning WHERE 
fin >= Date_Sub(curdate(), Interval 2 month)
and
( planning.IdIntervention  0 and planning.idStadePlanning  0)
and ( affaires.edi = 0 ) ORDER BY IdPlanning
I'm getting an error because query isn't correct

Posted: Tue 16 Dec 2008 12:16
by Dimon
I can not reproduce the problem.
TMyQuery on refreshing executes the same SQL query as on opening.
Please send me a complete small sample at dmitryg*devart*com to demonstrate the problem, including a script to create and fill table.

Posted: Tue 16 Dec 2008 15:30
by swierzbicki
Allright, I'll send you a demo project

Posted: Fri 19 Dec 2008 14:12
by Dimon
I did not get your e-mail. If you already have sent a demo, please send it again.