Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Driven VB Application - Help Me and others 1

Status
Not open for further replies.

Deadline

Programmer
Feb 28, 2001
367
US
Hi,
This posting is a combination of both VB & ASP. The requirement is to generate an ASP page for a survey form. Since we conduct several surveys within the organization, it is now decided to go for a VB application that will accept the Statement of each question, and the nature of each answer(like a descriptive answer or a multiple choice and if multiple choice then should it be radio button group or a check box group) etc.. and so on..


Have any one done this before ? If not, if you can come up with a code snippet it would be greatly helping me and others.


In advance..
Thanks!

RR


 
You need these database tables:
[tab]Quiz
[tab]QuizQuestion
[tab]Question
[tab]Answer
[tab]ChosenAnswer
[tab]GUIControlType
[tab]DataType

The Quiz table holds the name of the quiz.

The QuizQuestion table links questions to a particular Quiz (so you can re-use questions)

The Question table contains what you want to ask the user, plus whether it's a required question, and of the answers for the question, how many the user must select (1 of 5, 3 of 5, etc).

The Answer table (one row for each answer row), contains the control type from GUIControlType (textbox, textfield, checkbox, etc), the datatype from DataType of the expected answer (string, boolean, integer, etc), a flag indicating if the answer is the correct answer, etc.

So, you'd have:

Quiz:
[tab]QuizID of 18

QuizQuestion:
[tab]QuizID of 18, QuestionID of 4
[tab]QuizID of 18, QuestionID of 7

Question:
[tab]QuestionID of 4
[tab]QText of "What is your favorite color?"
[tab]Required of TRUE
[tab]MinAnswer of 1
[tab]MaxAnswer of 1

Answer:
[tab]QuestionID of 4
[tab]AnswerID of 94
[tab]AText of "Red"
[tab]GUIControlID of 3 (checkbox)
[tab]DataType of 1 (boolean)

[tab]QuestionID of 4
[tab]AnswerID of 95
[tab]AText of "Blue"
[tab]GUIControlID of 3 (checkbox)
[tab]DataType of 1 (boolean)


When the user fills out the question, the Selected Answer table contains:
[tab]QuizID of 18
[tab]SelectedAnswerID of 5502
[tab]QText of 4
[tab]AText of "Blue"

You don't want to put the QuestionID or the AnswerID in because someone might change the text, which would invalidate any existing user answer records (When the user took the quiz, the question was "How old are you?", to which they answered "41". The question is later changed to "How many times have you been married?", and the answer of "41" no longer makes sense unless you're Johnny Carson).

Hope this gets you started. I'm going to be out of town for the next week, so maybe someone else here can help you with the rest of it.

Chip H.
 
Ooops, I left the QText set to "4" in my answer. That should obviously be "What is your favorite color?"

Chip H.
 
Chip,
That was great enough to get started. Let me progress on these lines and I'll let you know the progress. Meanwhile, if you happen to write code for this problem, please share with us.

Much More, Thanks!

RR


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top