select applyriqi,audit from w_applyd where bmbh='002'and applyriqi like'2004-10%'and和前面的值连在一起了。

解决方案 »

  1.   

    你把你的sql语句打印出来看看
      

  2.   

    加空格啊,and前后,like之后也要的啊!
      

  3.   

    加了,还是不对啊
    debug结果:
    select applyriqi,audit from w_applyd where bmbh='002' and  applyriqi  like '2004-10%'
      

  4.   

    错误:java.sql.SQLException: ORA-00936: 缺少表达式
      

  5.   

    你的这个audit字段有问题,在oracle上这个是关键字。
      

  6.   

    select applyriqi,audit from w_applyd where bmbh='002' and  applyriqi  like '2004-10%'
    你把执行的sql语句改成这样
    select * from w_applyd where bmbh = '002' and year(applyriqi) = 2004 and month(applyriqi) = 10要确保bmbh是字符型  applyriqi是Date型
      

  7.   

    还有,注意不要使用关健字,最好在数据库连接客户端把SQL语句先执行一篇
      

  8.   

    like '2004-10%'
    这里的问题,Date型和String型不一样的
    最好使用between date1 to date2来操作。
      

  9.   

    还有就是用System.out.println(SQLString)在Sql Server里执行一次看看有没有错误
      

  10.   

    为什么不用PreparedStatement这个类呢?它可以传递很多参数进去的.
      

  11.   

    谢谢, SoftHt(無敵鏇風)  mudsong(寻找可能)(江西上饶) 用了关键字,导致出错,分有点少,别介意