快捷导航

select count(*) 在数据库中结果是1但rs.getInt(“num”)是0?

select count(*) 在数据库中结果是1但rs.getInt(“num”)是0?

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员2

sql语句你可以这样写:
String sql="select count(*) as num from admin where id=? and password=?";
查询结果遍历这样写:
while (rs.next()) {
i=Integer.valueOf(rs.getString("num"));
System.out.println("i="+i);
                        }
回复

使用道具 举报

我能说不可能吗?
如果真的如你所说,只可能你测试的sql和预处理语句拼接好的sql不一样。
回复

使用道具 举报

可能感兴趣的问答

发新帖
TA的信息
  • 会员所属: 注册会员
  • 认证信息: 邮箱认证手机认证
  • 微信访问
  • 手机APP