ADOQuery1. SQL. The Clear;
ADOQuery1. SQL. The Add (' SELECT * FROM Student WHERE (StudentDate BETWEEN ' ' '+ DateToStr (DateTimePicker1. Date) +' 00:00:00 'AND' ' '+ DateToStr (DateTimePicker2. Date) +' 23:59:59 ") ");
ADOQuery1. SQL. The Add ('? 'Sex AND Sex=.);//the gender fields in the data are not allowed to empty, when I don't choose this field is not query anything, can choose the query,
ADOQuery1. The Parameters. ParamByName (' Sex '). The Value:=trim (ComboBox1. Text);
ADOQuery1. Open;
Why add this condition, if you don't choose SEX, only according to the date of inquiry, query out content?