| | |
Need help with database linking!
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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
•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
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
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
![]() |
Similar Threads
- how to know address through IP address (Java)
- database problem (C#)
- linking ms access to webpage via html? (HTML and CSS)
- Database design regarding two 'linking' tables (Database Design)
- excel database linking with vb.net (VB.NET)
- "Error in linking List box with the VB6.0 database" (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: outputing contents of a Treeview
- Next Thread: Quick VB2005 help....how do I get this basic app started?
Views: 1785 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic browser button buttons center check checkbox code convert crystalreport cuesent data database datagrid datagridview date datetimepicker design designer dissertation dissertations dissertationtopic dropdownlist eclipse excel fade filter ftp generatetags gridview images inline input insert installer intel internet lib listview mobile monitor net objects panel passingparameters pdf picturebox port position print printing problem read remove save searchbox searchvb.net select serial settings shutdown soap sorting studio survey table tcp temperature textbox time timer timespan transparency trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year





