public void DeleteQuiz(QuizData theQuiz) { if (DataReader != null) { DataReader.Close(); } QuestionEntity quest = new QuestionEntity(); for (int i = 0; i < theQuiz.Questions.Count; i++) { quest.DeleteQuestion(theQuiz.Questions[i]); } quest.Dispose(); SQL = "DELETE `quizzes`, `rel_courses_quizzes` FROM `quizzes` INNER JOIN `rel_courses_quizzes` ON `quizzes`.`quiz_id` = `rel_courses_quizzes`.`quiz_id` WHERE `quizzes`.`quiz_id` = \"" + theQuiz.Id + "\";"; InitializeCommand(); OpenConnection(); int result = ExecuteStoredProcedure(); CloseConnection(); if (result == 0) { throw new Exception("Could not delete the Quiz from Database"); } }
public void DeleteQuiz(QuizData theQuiz) { if (DataReader != null) DataReader.Close(); QuestionEntity quest = new QuestionEntity(); for (int i = 0; i < theQuiz.Questions.Count; i++) quest.DeleteQuestion(theQuiz.Questions[i]); quest.Dispose(); SQL = "DELETE `quizzes`, `rel_courses_quizzes` FROM `quizzes` INNER JOIN `rel_courses_quizzes` ON `quizzes`.`quiz_id` = `rel_courses_quizzes`.`quiz_id` WHERE `quizzes`.`quiz_id` = \"" + theQuiz.Id + "\";"; InitializeCommand(); OpenConnection(); int result = ExecuteStoredProcedure(); CloseConnection(); if (result == 0) throw new Exception("Could not delete the Quiz from Database"); }