Start New Discussion within our Software Development Community

Hi guys!

I have a JTable updated from MySQL. I can successfully insert a row in JTable using SQL statement "insert into...". However, when I execute a delete statement, then JTable is not updated. Please, help me to find an error.

public void actionPerformed(java.awt.event.ActionEvent evt) {
                SystClasses.FilterClass.tableModel.initDB("", "employee_record", "liana", "liana1982");
                int id = tableDetails.getSelectedRow()+1;

                SystClasses.FilterClass.tableModel.setQueryDelete("delete from employee where id ='"+id+"'");

  public void setQueryDelete(String q) {
    try {
      // Execute the query and store the result set and its metadata
      int rs = statement.executeUpdate(q);

      fireTableChanged(null); // notify everyone that we have a new table.
      } catch (Exception e) {
      cache = new Vector(); // blank it out and keep going.
This question has already been answered. Start a new discussion instead.