我要实现一个查询功能:在两个日期之间查找所需要的日期。程序段如下:
var
   rq:string
begin
rq:='select * from persion where '''datetostr(DateTimePicker1.Date)+combobox3.text+'''出生日期'''+combobox3.text+datetostr(DateTimePicker2.date)'''';
.....
end;
combobox.text包括> < =
请问大虾,上面的程序段还有什么要改的。谢谢了!!

解决方案 »

  1.   

    select * from a where '+combobox1.text+'  '+combobox2.text+' '''+datetostr(rq1.date)+'''
    rq(动态) >=(动态)  rq1.date
      

  2.   

    var
       rq:string
    begin
      rq:='select * from persion where 出生日期 '
         +ComboBox1.Text+QuotedStr(datetostr(DateTimePicker1.Date))
         +' And 出生日期 '+ComboBox2.Text
         +QuotedStr(DateToStr(DateTimePicker2.Date));
         ...........
    End
    可以实现你的要求。
      

  3.   

    wangzwang,我刚才试过了,编译是没有错,可是在运行时有这样一个错误:Type mismatch in expression.请问这是什么错误啊?