adodataset1.commandtext:='select * from 货物信息 where 货物ID='''+huowuid+'''';
其中huowuid是longint类变量,总是显示“标准表达式中类型不匹配”错误,把huowuid改成inttostr(huowuid)也不行,请教各位老师。

解决方案 »

  1.   

    var huowuid:integeradodataset1.commandtext:='select * from 货物信息 where 货物ID='+huowuid;
     
    整形的不用加单引号,如果货物ID是Varchar,那么应该是
    adodataset1.commandtext:='select * from 货物信息 where 货物ID='+Quotedstr(huowuid);
      

  2.   

    星雨老师:
        不行呀,这样编译不过去,显示missing operator or semicolon;
      

  3.   

    adodataset1.commandtext:='select * from 货物信息 where 货物ID='+ IntToStr(huowuid);
      

  4.   

    同意Dlwxn(Dlwxn)   sql语句中的变量也应该是string
      

  5.   

    谢谢,dlwxn的完全正确,谢谢以上两位老师