This is my link class fill-up form:

 private void cmd_updateActionPerformed(java.awt.event.ActionEvent evt) {                                           
        UserClass UC = new UserClass();

        String password = new String(PW.getPassword());
        String confirmPassword = new String(RPW.getPassword());
        try {
       if(!UN.getText().trim().equals("")&&!RPW.getText().trim().equals("")) {


            DefaultTableModel model = (DefaultTableModel) UC.table_user.getModel();

            String value1 = UN.getText();
            String value2 = PW.getPassword().toString();

            model.setValueAt(value1, UC.table_user.getSelectedRow(), 0);
            model.setValueAt(value2, UC.table_user.getSelectedRow(), 1);
            String sql="update user set Username='"+value1+"', Password='"+value2+"' where username='"+value1+"'";


            pst=conn.prepareStatement(sql);
             pst.executeUpdate();

            if(password.equals(confirmPassword)) {




                 JOptionPane.showMessageDialog(this, "Successfully Saved!", "Success", JOptionPane.INFORMATION_MESSAGE);
             this.setVisible(false);


            }
            else {
                JOptionPane.showMessageDialog(this, "Please Enter The Right Password!" , "Mismatch", JOptionPane.INFORMATION_MESSAGE);
            } 
         }else {
           JOptionPane.showMessageDialog(null, "Please fill-up the blank form");
       }
        }catch (SQLException e) {
            JOptionPane.showMessageDialog(null, e);


        }    
    }  

This my menuitem where my jTable stored:

private void cmd_updateActionPerformed(java.awt.event.ActionEvent evt) {                                           
        EditUserAccount EUA = new EditUserAccount (null, true);
        EUA.setVisible(true);
        Update_table();

    } 

When I click the save button it shows an error.
The name of my link class is "EditUserAccount".

when i remove these codes:

            DefaultTableModel model = (DefaultTableModel) UC.table_user.getModel();

            model.setValueAt(value1, UC.table_user.getSelectedRow(), 0);
            model.setValueAt(value2, UC.table_user.getSelectedRow(), 1);

it shows Successfully saved but nothing will change to my jTable

"When I click the save button it shows an error."

What is the exact complete error message?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.