Advice needed on exam application design
I am creating a desktop software in WPF that is more like an exam...So I have four sections of the exam, the exam to be taken is selected by the user on the basis of a number selected from a dropdownList control. So once a user selects a number from a drop down, it goes t开发者_运维技巧o the database and retrieves the questions with that ID and displays in a grid view control. Now my question is: 1)Should I store the title of the Exam in the database,so when the user selects a value from drop down,the heading is retrieved from the table corresponding to that dropdown value and then when subsequently when user clicks the start button,it starts displaying the questions in the database.First section on the first page,second section on the second page and so on..
Anyone got a better idea? Please suggest, I will really appreciate it.
I'd suggest 2 tables (simplified):
EXAM: columns ID
, TITLE
EXAM_QUESTION: columns ID
, EXAM_ID
(foreigh key to EXAM.ID
), QUESTION
When you start your application, you load the entire EXAM table and bind your dropdown list to it. Each time user selects an item in that dropdown list, you load the list of corresponding EXAM_QUESTION entries and bind your grid (that would be ideally cached).
I would go with three tables (assuming it'll offer multiple choice). Exams, exam_questions, and question_answers. An exam can have many questions, an exam_question can have many question_answers.
exams: ID, TITLE
exam_questions: ID, EXAM_ID, QUESTION
question_answers: ID, EXAM_QUESTIONS_ID, ANSWER
精彩评论