can not issue executeupdate() for selects in netbeans : Good day ,

While I am trying to update data after inserting new ones in the database, 

This message is showing for me 

    can not issue executeupdate() for selects

I have checked [tutorialspoint.com][1] and [codejava][2] and the codes for both update and select are the same and the program is issuing the statement above 

Here is my codes 

         String Sql="Select * from training where trainID=? "; 
            try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/hr","root","MZaa8891@");
            ps= con.prepareStatement(Sql);
            ps.setString(1, jTextField1.getText());
            rs =ps.executeQuery();
            while (rs.next()){
               jTextField2.setText(rs.getString("traTitle"));
           }
            }
            catch (Exception e){
    
        JOptionPane.showMessageDialog(null, e);
        }
        } 
             String Sql="Select * from training where traTitle =? "; 
            try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/hr","root","MZaa8891@");
            ps= con.prepareStatement(Sql);
            ps.setString(1, jTextField1.getText());
            rs =ps.executeQuery();
            while (rs.next()){
               jTextField2.setText(rs.getString("trainID"));
           }
            }
            catch (Exception e){
    
        JOptionPane.showMessageDialog(null, e);
        }
     String Sql= "UPDATE training SET traTitle ='"+ jTextField2.getText()+"', Type = "+(String) jComboBox1.getSelectedItem()+"', SDate = '"+sqlDate+"', Edate = '"+sqlDate2+"', location = '"+jTextField3.getText()+"',provider = '"+(String) jComboBox1.getSelectedItem()+"',related = '"+jTextArea1.getText()+"',benefits = '"+jTextArea2.getText()+"'important = '"+jTextArea3.getText()+"' WHERE trainID = "+jTextField1.getText()+"";
         try {
             Class.forName("com.mysql.jdbc.Driver");
          con = DriverManager.getConnection("jdbc:mysql://localhost:3306/hr","root","MZaa8891@");
           Statement st = con.createStatement();
          int i =ps.executeUpdate();
            if (i>0)
            {
                    JOptionPane.showMessageDialog(null, "Data is Saved");
            }
            else {
                    JOptionPane.showMessageDialog(null, "Data is not Saved");
            }
        }
        catch (Exception e){
        JOptionPane.showMessageDialog(this, e.getMessage());
        JOptionPane.showMessageDialog(null, e);
        }

Any Solution ? 
                                          


  [1]: https://www.tutorialspoint.com/jdbc/jdbc-update-records.htm
  [2]: http://www.codejava.net/java-se/jdbc/jdbc-tutorial-sql-insert-select-update-and-delete-examples