private void deleteBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteBtnActionPerformed
        // TODO add your handling code here:
        try  {
            
            connectDb();
             int selectedRow = questionTable.getSelectedRow();
             rowID = (questionTable.getModel().getValueAt(selectedRow,1).toString());
             
             
            int errors = 0;
            
            String deleteAnswer = "DELETE FROM mcqoption WHERE Question_ID='"+rowID+"'";
            int rows1 = st.executeUpdate(deleteAnswer);
            if (rows1 == 0) {
                 errors++;
            }
            
             
            String deleteQuestion = "DELETE FROM question WHERE Question_ID='"+rowID+"'";
            int rows2 = st.executeUpdate(deleteQuestion);
             if (rows2 == 0) {
                 errors++;
             }
            
             
            String deleteMCQ = "DELETE FROM mcq WHERE Question_ID='"+rowID+"'";
            int rows3 = st.executeUpdate(deleteMCQ);
            if (rows3 == 0) {
                 errors++;
            } 
             
             if (errors != 0) {
                JOptionPane.showMessageDialog(null, "Question was successfully deleted!"); 
                refresh();
             } else {
                 JOptionPane.showMessageDialog(null, "ERROR : Delete was not successfull!");
                 refresh();
             }
             

        }  catch (Exception exc) {
            exc.printStackTrace();
        }
    }//GEN-LAST:event_deleteBtnActionPerformed