title: Inserting into a database from a java GUI
body: <p>Hi can someone tell me whats wrong with my code. It inserts the package into my arrayList but it will not insert it into my DB. The code posted below will run each time the user presses the add button on the GUI Thanks in advance!</p>
  
  <pre><code>  //Add package
      String time = new SimpleDateFormat("DD.MM.YYYY.HH.mm.ss").format(new java.util.Date());
      String name = nameInputTF.getText();
      String address = addressInputTF.getText();
      String city = cityInput.getText();
      String county = (String) countyCombo.getSelectedItem();
      String contact = contactInput.getText();
      String description = descriptionInput.getText();
      double price = Double.parseDouble(priceInput.getText());
      boolean prepaid = true || false;
      id++;
  
      //Adding packages to the list
      packages.add(new Package(id, time, name, address, city, county, contact, description, price, prepaid));
  
      //Method to display packages in the text field
      displayList();
  
      //Method to set all button visibility to false
      buttonsFalse();
  
      // Method that sets all text fields to blank
      fieldsBlank();
  
      try {
          String sql = "INSERT INTO packages VALUES (?,?,?,?,?,?,?,?)";
          statement = conn.prepareStatement(sql);
  
          statement.setString(1, packIDInput.getText());
          statement.setString(2, arrivedInput.getText());
          statement.setString(3, nameInputTF.getText());
          statement.setString(4, addressInputTF.getText());
          statement.setString(5, contactInput.getText());
          statement.setString(6, priceInput.getText());
          statement.setString(7, countyCombo.getName());
          statement.setString(8, cityInput.getText());
  
          rs = statement.executeQuery();
  
      } catch (SQLException ex) {
          Logger.getLogger(A2ZTransit.class.getName()).log(Level.SEVERE, null, ex);
      }
  
  
  }                                       
  </code></pre>