Help to deal with data filtering. I use a database of accessors, components ADOConnection, ADOQuery, ADODataSource, DBGrid, a pair of DateTimePicker and one BitBtn I set the query in SQL:

SELECT * FROM Архив WHERE Дата_выписки>= :first_date AND <= :last_date 

Not even burst. What is wrong doing, help.
UPD: I write in button processing:

 procedure TForm1.BitBtn1Click(Sender: TObject); var Date1,Date2:string; begin Date1:= DateTimePicker1.DateTime; Date2:= DateTimePicker2.DateTime; Form1.ADOQuery1.Active:= False; Form1.ADOQuery1.SQL.Clear; Form1.ADOQuery1.SQL.Add('SELECT *FROM Архив'); Form1.ADOQuery1.SQL.Add('WHERE Дата_выписки'); Form1.ADOQuery1.SQL.Add('BETWEEN ('+Date1+') AND ('+Date2+')'); Form1.ADOQuery1.Active:= True; end; end; 

It does not go. What's wrong?

    2 answers 2

    1. Correct the error: WHERE Billing Date> =: first_date AND Billing Date <=: last_date
    2. So even simpler: WHERE Billing_Date between: first_date and: last_date

      Faced))) Most likely the problem is in the mismatch of date-time formats. Pass the date as a parameter. You have the same request as a parameter in the original request ..: first_date is the syntax of the parameter and pass the parameter to the request agree themselves)))