.executeQuery(); while(rs.next()) { jBean.setId(rs.getInt("id")); jBean.setName(rs.getString("name")); jBean.setPassword(rs.getString("password")); jBean.setSex(rs.getString("sex")); jBean.setAge(rs.getInt("age")); } }catch(SQLExceptione) { e.printStackTrace(); } returnjBean; }?/**?*@authorhelp?*?*更新某一条记录?*@return?*/?publicintgetUpdate(Stringsql,JavaBeanjBean)?{ intcount=0; try{ pre=con.prepareStatement(sql); pre.setInt(5,jBean.getId()); pre.setString(1,jBean.getName()); pre.setString(2,jBean.getPassword()); pre.setString(3,jBean.getSex()); pre.setInt(4,jBean.getAge()); count=pre.executeUpdate(); }catch(SQLExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); } finally { try{ pre.close(); con.close(); }catch(SQLExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); } }