private void UpdateStudentProfile(String studentNo) throws Exception {
    try (IDatabaseConnection connection = DatabaseConnectionService.createDatabaseConnection()) {
      // Address table needs to be updated before updating the student table due to foreign key
      // constraint
      UpdateStudentAddress(connection);
      try (IStatementExecutor stmtExecutor =
          DatabaseConnectionService.createStatementExecutor(connection)) {

        String updateStudentProfileInfo =
            String.format(
                "UPDATE Students "
                    + "SET homePhone = '%s',"
                    + "workPhone = '%s',"
                    + "sex = '%s',"
                    + "nationality = '%s',"
                    + "street = '%s',"
                    + "city = '%s',"
                    + "pincode = '%s'"
                    + "WHERE studentNo = '%s'",
                homePhoneTextBox.getText(),
                workPhoneTextBox.getText(),
                sexTextBox.getText(),
                nationalityTextBox.getText(),
                streetTextBox.getText(),
                cityTextBox.getText(),
                pincodeTextBox.getText(),
                studentNo);

        stmtExecutor.executeUpdate(updateStudentProfileInfo);
      }
    }
  }
 private void ChangeEditModeOfTextBoxes(boolean makeEditable) {
   homePhoneTextBox.setEditable(makeEditable);
   workPhoneTextBox.setEditable(makeEditable);
   sexTextBox.setEditable(makeEditable);
   nationalityTextBox.setEditable(makeEditable);
   streetTextBox.setEditable(makeEditable);
   cityTextBox.setEditable(makeEditable);
   pincodeTextBox.setEditable(makeEditable);
 }
  private void UpdateStudentAddress(IDatabaseConnection connection) throws Exception {
    try (IStatementExecutor stmtExecutor =
        DatabaseConnectionService.createStatementExecutor(connection)) {
      String updateStudentAddressInfo =
          String.format(
              "INSERT INTO Addresses (street,city,pincode)"
                  + " SELECT '%s','%s','%s' FROM DUAL"
                  + " WHERE NOT EXISTS"
                  + "(SELECT * FROM Addresses WHERE street='%s' AND city='%s' AND pincode='%s') ",
              streetTextBox.getText(),
              cityTextBox.getText(),
              pincodeTextBox.getText(),
              streetTextBox.getText(),
              cityTextBox.getText(),
              pincodeTextBox.getText());

      stmtExecutor.executeUpdate(updateStudentAddressInfo);
    }
  }
 private void SetRowValuesToTextboxControls(final IQueryResultSet resultSet) {
   studentNoTextBox.setText(resultSet.getString("studentNo"));
   firstNameTextBox.setText(resultSet.getString("firstName"));
   lastNameTextBox.setText(resultSet.getString("lastName"));
   dobTextBox.setText(resultSet.getString("dob"));
   homePhoneTextBox.setText(resultSet.getString("homePhone"));
   workPhoneTextBox.setText(resultSet.getString("workPhone"));
   sexTextBox.setText(resultSet.getString("sex"));
   nationalityTextBox.setText(resultSet.getString("nationality"));
   deptIdTextBox.setText(resultSet.getString("deptId"));
   streetTextBox.setText(resultSet.getString("street"));
   cityTextBox.setText(resultSet.getString("city"));
   pincodeTextBox.setText(resultSet.getString("pincode"));
   classificationTextField.setText(resultSet.getString("STUDENTCLASSIFICATION"));
   degreeTextField.setText(resultSet.getString("DEGREEPROGRAM"));
   yearTextField.setText(resultSet.getString("STUDENTPROGRAM"));
 }