javaweb Update的结果返回值一直是1,根据网络上的useAffectRows=true,还是结果返回1是怎么回事?

能更改成功,但是返回值一直是1,在后面的判断中起了很大的问题
dbutil

private static String driver = "com.mysql.jdbc.Driver";
private static String url = "jdbc:mysql://localhost:3306/on?useUnicode=true&characterEncoding=utf-8&useAffectRows=true";
private static String user = "root";
private static String password = "123456";

public int userState(int n) {
int count = -1;
String sql = "UPDATE system SET userstate=? WHERE id='1'";
Connection conn = null;
PreparedStatement pstmt = null;

    conn = DBUtil.getConn();
    try {
        pstmt = conn.prepareStatement(sql);
        pstmt.setObject(1, n);

         count = pstmt.executeUpdate();

    } catch (Exception e) {
        // TODO: handle exception
    }finally{
        DBUtil.closeAll(conn, pstmt, null);
    }
    return count;
}

你的sql语句的update条件是 id = 1,先确认一下数据库里面 id = 1的记录有多少条;

你写错了,应该是 userAffectedRows=true