首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

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

2012-12-16 
使用spring的jdbcTemplate做查询时遇到的问题。。。 String handlersqlselect count(*)from d_handler wher

使用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

热点排行