SQL本身就是一个字符串,还要变成TDateTime干什么?直接+MaskEdit1.Text就可以了。

解决方案 »

  1.   

    这样试试
    datamodule.query.sql.add('and 入伍年月日='''+strtodatetime(maskedit1.text)+''''); 
      

  2.   

    单引号不是你那样用de……
    改为
    datamodule.query.sql.add('and 入伍年月日='+strtodatetime(maskedit1.edit)); 试试如果还不行,就要用参数了
    datamodule.query.sql.add('and 入伍年月日=:rw_date); 
    datamodule.query.ParamByName('rw_data').asstring:=maskedit1.text;第二句或者是
    datamodule.query.ParamByName('rw_data').asdate:=strtodatetime(maskedit1.text);知道maskedit控件的属性,推荐两本书,《Delphi 5程序设计与控件参考》和《Delphi 运行时间库RTL和组件库VCL技术参考》,其中第一本书网上好象又下载的,好好找找吧!