Bonjours à tous,

J'ai une application de gestion, je fait une requette SQL pour sélectionner des enregistement :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
 
  String Req ;
  Word Year, Month, Day ;
  DecodeDate(Fm_Choisir_Date -> MonthCalendar1 -> Date, Year, Month, Day);
 
  Req = "Select * from Incidents where MONTH(Incidents.Date)=" + IntToStr(Month) + "\nAND " +
                                        "DAY(Incidents.Date)=" + IntToStr(Day) + "\nAND " +
                                        "YEAR(Incidents.Date)=" + IntToStr(Year) ;
  DataModule1 -> Rapport_Journalier -> SQL -> Clear() ;
  DataModule1 -> Rapport_Journalier -> SQL -> Add(Req) ;
  DataModule1 -> Rapport_Journalier -> Open() ;
ça marche bien,

mais quand j'utilise le code suivant pour une requette entre deux dates, il nya pas de résultat.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
  String Req,d1,d2 ;
  d1 = FormatDateTime("MM/DD/YYYY",Fm_Choisir_Deux_Date -> MonthCalendar1 -> Date) ;
  d2 = FormatDateTime("MM/DD/YYYY",Fm_Choisir_Deux_Date -> MonthCalendar2 -> Date);
  Req = "Select * from Incidents where Incidents.Date between #" +
         d1 +"# and #" +
         d2 +"#" ;
 
  DataModule1 -> Rapport_Journalier -> SQL -> Clear() ;
  DataModule1 -> Rapport_Journalier -> SQL -> Add(Req) ;
  DataModule1 -> Rapport_Journalier -> Open() ;
Pouvez-vous m'aider à résoudre ce problème.

@+