日期:2014-05-16 浏览次数:20417 次
String sql="SELECT COUNT(*) FROM tbUser WHERE userName=? AND userPassword=?"; PreparedStatement pps=conn.prepareStatement(sql); pps.setString(1, "test"); pps.setString(2, "202CB962AC59075B964B07152D234B70"); ResultSet rs = pps.executeQuery(); boolean flag=rs.next(); System.out.println(flag); if (flag) { System.out.println(" 有当前用户: "+rs.getInt(1)); }