select * from [myMoneys] where Dates='+datetostr((Date()-1));dates为DATETIME型。我改成VARCHAR试了也报错。报错:对象名myMoneys无效

解决方案 »

  1.   

    你里面有这个myMoneys表吗?而且应该这么写:commandtext := 'select * from [myMoneys] where Dates='+QuotedStr(datetostr((Date()-1))));
      

  2.   

    也可以写成:
    'select * from [myMoneys] where Dates='''+datetostr(Date()-1)+''';
      

  3.   

    有这个表的,为什么要写成commandtext := 'select * from [myMoneys] where Dates='+QuotedStr(datetostr((Date()-1))));
    我是用ADOQUERY的。写成上成的形式后我是不是用ADOQUERY.EXECSQL来执行?
      

  4.   

    TO hch_45(んこん) :
    我一开始也是这样写的,但也是错的。
      

  5.   

    这样也是对的
    'select * from [myMoneys] where Dates='''+datetostr(Date()-1)+''''
      

  6.   

    ADOQUERY.EXECSQL('select * from [myMoneys] where Dates='''+datetostr(Date()-1)+'''')