请问select * from lrcx where '年龄' > '" & CInt(Trim(Text2.Text)) & "'错在哪里,此语句where语句没有作用。但把年龄的引号去掉,提示数据不匹配。我用Access数据库,对应数据格式我已经设置。请问怎么办?

解决方案 »

  1.   

    年龄字段是字符串
    select * from lrcx where 年龄 > '" & CInt(Trim(Text2.Text)) & "'"
    年龄字段是数值类型
    select * from lrcx where 年龄 > " & CInt(Trim(Text2.Text))
      

  2.   

    "select * from lrcx where 年龄 > " & CInt(Trim(Text2.Text))
      

  3.   

    按照你的说法,肯定是你的字段不匹配, cuizm(射天狼) 说的对。
    "select * from lrcx where 年龄 > " & CInt(Trim(Text2.Text))
      

  4.   

    如果年龄是数值型的,
    select * from lrcx where 年龄 > " & CInt(Trim(Text2.Text))
    是可以的啊
    另外我想年龄大小还是不要硬性的写进数据库为好,  可以只写出生日期,
    通进计算字段来得出年龄,这样就不必第年都去改年龄字段了,你说呢?
      

  5.   

    虽然你用了cint,但用单引号括起来又把它转换成了字符串,去掉即可。
    另外字段名“年龄”是不需要单引号的,也要去掉