0

I use Dbutils to call elements in one table of database

private void showEvent(){

    try {
        String query="SELECT EventID, MemberID,Description, Date, 
        Time, Venue, EventTypes  FROM formal UNION SELECT EventID, 
        MemberID,Description, Date, Time, Venue, EventTypes FROM social";

        ps = c.prepareStatement(query);

        rs=ps.executeQuery();

        tbShowEvent.setModel(DbUtils.resultSetToTableModel(rs));

    } catch (SQLException ex) {
        Logger.getLogger(ShowEvent.class.getName()).log(Level.SEVERE, null, ex);
    }
}

How to delete one element in table when I click the mouse to that element

enter image description here Illustration: https://i.stack.imgur.com/ib77V.png

Charles
  • 50,943
  • 13
  • 104
  • 142

1 Answers1

0
  • add an event listener on your delete button
  • create your stored procedure code for the delete in the event listener.
  • after a succesful delete in the DB delete the row in your table in the table Model
  • refresh you table. Call fireTableDataChanged() on your tableModel
Oliver Watkins
  • 12,575
  • 33
  • 119
  • 225