private void list_hapusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_list_hapusActionPerformed
        if (tbldetail.getSelectedRow() > -1){
            int row = tbldetail.convertRowIndexToView(tbldetail.getSelectedRow());
            DefaultTableModel tbl =(DefaultTableModel) tbldetail.getModel();
            
            try {
                Class.forName ("com.mysql.jdbc.Driver");
                String urldb="jdbc:mysql://localhost:3306/restaurant";
                String user=main.dbUser;
                String password=main.dbPassword;
                Connection koneksi=java.sql.DriverManager.getConnection(urldb,user,password);
                String strSQL = "delete from `detail_pesanan` "
                              + "where `no_pesanan` = '"+nopesanan.getText()+"' and  `nama` = '"+tbl.getValueAt(row, 0).toString()+"'";

                Statement st = koneksi.createStatement();
                st.executeUpdate(strSQL);

                st.close();
                koneksi.close();
            }catch(ClassNotFoundException cnfe){
                System.out.println("kesalahan saat"+"me-load driver jdbc \n"+cnfe.getMessage());
            }catch(SQLException sqle){
                System.out.println("keslahan saat koneksi atau "+"kesalahan query sql \n"+sqle.getMessage());
            }
            tbl.removeRow(row);
        }
    }//GEN-LAST:event_list_hapusActionPerformed