public ManagerServiceImpl() { try { connection = DB.getConnection(); } catch (DataBaseException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void UpdatePersonalInfo(UpdatePersonalInfoForm updatePersonalInfoForm) throws UpdateDataException, DataBaseException { Connection connection = DB.getConnection(); String sql = "update DormManage set DMPhone=? where DMid=" + updatePersonalInfoForm.getOwnerId(); // System.out.println(sql); try { PreparedStatement pstmt = connection.prepareStatement(sql); pstmt.setString(1, updatePersonalInfoForm.getPhone()); pstmt.execute(); } catch (SQLException e) { e.printStackTrace(); throw new UpdateDataException(); } }