select count(userid) as countNum from tableName;
ResultSet rs=ps.executeQuery();
int nums=rs.getInt(0);
好像是这样,你可以试一下!
int count=0;
PreparedStatement pstmt = conn.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
rs.next();
count = rs.getInt(1);
return count;
描述不清啊。