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.

Edited 6 Years Ago by LianaN: n/a

I solved the problem. Thank you.

Edited 6 Years Ago by LianaN: n/a

This question has already been answered. Start a new discussion instead.