Ado_p.Connection:=Adoc;
Ado_P.SQL.Clear;
ado_p.SQL.Add('select * from BookRecord where ((卡号=:kh) and (入住时间>= :StartDate) and (入住时间<= :Enddate))');
ado_P.Parameters.ParamByName('kh').Value:=Ed_ddh.Text;
ado_P.Parameters.ParamByName('StartDate').Value :=Startdate.Date;
ado_P.Parameters.ParamByName('Enddate').Value :=enddate.Date;
ado_p.ExecSQL;执行为何显示错误:"标准表达式中数据类型不匹配"请问怎么解决这个问题?谢谢了.

解决方案 »

  1.   

    ado_P.Parameters.ParamByName('kh').Value:=Ed_ddh.Text;
    卡号是什么类型的?是char或varchar么
      

  2.   

    用ado_p.open仍然提示:"标准表达式中数据类型不匹配"
      

  3.   

    ado_P.Parameters.ParamByName('StartDate').Value :=Startdate.Date;
    ado_P.Parameters.ParamByName('Enddate').Value :=enddate.Date;
    这两个有问题,你先转为字符串再赋值吧
      

  4.   

    把你的字段的类型帖出来看看!
    字段不匹配就看字段类型啊然后把
    ExecSQL ---->替换成 sql.open;
      

  5.   

    把字段类型帖出来
    看看啊然后把
    Execsql替换成sql.open;
      

  6.   

    shxchenwind(秋风扫落叶) 问题已解决.谢谢.
    问题出在select中有条件时,日期型数据需转换成字符型。