private void addTrainingAttendedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTrainingAttendedActionPerformed
        String trnTitle = trainingTitle.getText();
        String trnDate = ((JTextField)trainingDate.getDateEditor().getUiComponent()).getText();
        String trnPersonnel = trainingPersonnel.getText();
        
        if(!"".equals(trnTitle)){
            boolean flag = ifExist(trnTitle,trnDate,trnPersonnel);
            if(flag){
                String sql = "insert into EmpTrainingAttended (empNo,trainingTitle,trainingDate,trainingPersonnel) values (?,?,?,?)";
                try{
                    conn = DBConnect.connect();
                    pst = conn.prepareStatement(sql);
                    pst.setString(1, empNm);
                    pst.setString(2, trnTitle);
                    pst.setString(3, trnDate);
                    pst.setString(4, trnPersonnel);
                    pst.execute();

                    JOptionPane.showMessageDialog(null, "Command successful!");
                    trainingTitle.setText("");
                    trainingDate.setDate(null);
                    trainingPersonnel.setText("");
                    trainingTitle.requestFocus(true);
                }
                catch(Exception e){
                    JOptionPane.showMessageDialog(null, e);
                }
                finally{
                    if(pst != null){
                         try{
                             pst.close();
                        }
                        catch(SQLException e){

                        }
                    }
                    if(conn != null){
                         try{
                             conn.close();
                        }
                        catch(SQLException e){

                        }
                    }
                }
                initTrainingAttendedTable();
            }
            else{
                JOptionPane.showMessageDialog(null, "Command unsuccessful!\nValues already exist");
            }
        }
        else{
            JOptionPane.showMessageDialog(null, "Command unsuccessful!\nTraining Title is empty");
        }
    }