Need help with database linking!

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2006
Posts: 21
Reputation: Mikecool509 is an unknown quantity at this point 
Solved Threads: 0
Mikecool509's Avatar
Mikecool509 Mikecool509 is offline Offline
Newbie Poster

Need help with database linking!

 
0
  #1
Feb 8th, 2006
First of all, this is NOT for homework, so if you help, you WON'T be doing my homework for me! :lol: I am trying to create a quiz site for my school. I want the trachers to be able to create quizzes for their students. They will fill out a form to do so. However, with each new question they create, they need to associate it with a "QuizID", which will associate each question with their new quiz. How should i go about preventing duplicate "QuizIDs" so that questions and quizes don't merge, due to two identical "QuizIDs"? thanks! P.S. I am programming in Visual Basic.NET
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 275
Reputation: f1 fan is an unknown quantity at this point 
Solved Threads: 11
f1 fan f1 fan is offline Offline
Posting Whiz in Training

Re: Need help with database linking!

 
0
  #2
Feb 9th, 2006
I am not quite sure of your requirements.
You want a quiz and it has an id (say QZ1) and then you want a question with an id (say Q1) and then to associate it to the quiz... but you want to make sure that this question hasnt already been used?

If that is the case you need an association table (which i would use anyway so you could resuse the questions in other quizzes - ie you have a bank of questions and pull them out for a quiz - which is how most exams work anyway). So you have a table of quizzes each with their own id and a name (or whatever you need) and a table of questions (and probably a table of answers to the questions). Then a quiz-question association table which will have two columns (usually) one for the quiz id and one for the question id. Then make the two columns a primary key (that is the two columns together make one primary key). That forces the quizid, question id combination to be unique (and also fast for you searches etc). That way a question can only appear once in a quiz but can be in in other quizzes too as the quizid question id combination will be different.

If this is a bit confusing let me know and i will try and clarify
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1785 | Replies: 1
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC