public UserAccount findUserAccount(UserAccount user)
{
Connection conn = DBTool.getInstance().getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
String id = user.getUserId();
String newuserPsw = user.getUserPsw();
System.out.println( "yizhixing001 ");
try{
ps = conn.prepareStatement( "UPDATE BBS_USER SET USERPSW = ' "+newuserPsw+ " '
WHERE USERPSW = "+id);
rs = ps.executeQuery();
while(rs.next()){
user = new UserAccount();
user.setUserId(rs.getString( "userId "));
user.setUserPsw(rs.getString( "userPsw "));
user.setPswquestion(rs.getString( "pswquestion "));
user.setPspanswer(rs.getString( "pspanswer "));
System.out.println( "002 ");
}
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
DBTool.closeAll(conn, ps, rs);
}
return user;
}
yizhixing001能输出,002不能输出,异常就是java.sql.SQLException: ORA-01002: 提取违反顺序,求解释啊
------解决方案--------------------
你执行的是UPDATE语句,没有结果集返回,改成SELECT语句吧。