当前位置: 代码迷 >> Java Web开发 >> 使用spring的jdbcTemplate做查询时遇到的有关问题。
  详细解决方案

使用spring的jdbcTemplate做查询时遇到的有关问题。

热度:5224   发布时间:2013-02-25 21:07:52.0
使用spring的jdbcTemplate做查询时遇到的问题。。。
 String handlersql="select count(*)  from d_handler where unitcode=? and handlercode=?";
    int handlercount=jdbcTemplate.queryForInt(handlersql,logininfo.getUnitcode(),logininfo.getHandlercode());
 表里是有一条上面对应的数据的,打印的sql也正常,但是就是 handlercount查出来是0,求高手解决。。。。。。。。 
------最佳解决方案--------------------------------------------------------
String handlersql="select count(*)  from d_handler where unitcode=? and handlercode=?";错了
改为:String handlersql="select count(h)  from d_handler as h where unitcode=? and handlercode=?";
------其他解决方案--------------------------------------------------------
先打印确定下 logininfo.getUnitcode(),logininfo.getHandlercode()) 是你期望的值不
------其他解决方案--------------------------------------------------------
引用:
String handlersql="select count(*)  from d_handler where unitcode=? and handlercode=?";错了
改为:String handlersql="select count(h)  from d_handler as h where unitcode=? and handlercode=?";
……

   原因呢?
------其他解决方案--------------------------------------------------------
 
引用:
先打印确定下 logininfo.getUnitcode(),logininfo.getHandlercode()) 是你期望的值不

是的。然后呢?
------其他解决方案--------------------------------------------------------
null
  相关解决方案