If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: Design Issue

I posted this also in the Visual Basic section:

I'm working with: VB6 and SqlServer 2000

I'm creating an application that requires users to answer several questions and based on answers to those questions, certain conditions result, such as the ability to view certain sections of the questionaire and/or more questions appear and/or some questions become irrelavent and/or mathematical formulas work one way or another based on an answer to a question.

Here is an example:
The user has to answer a question. For this particular question, if the user chooses Yes then I must "Activate" all of the questions that are flagged with the code X. If the user chooses No then I must "Activate" all of the questions that are flagged with Y and "Deactivate" all of the questions that are flagged with Z.

I'm coming across a design issue (both with the application itself and the database). What is the best way to store all of this in a database? Should I store the questions along with the list of possible answers and their corresponding conditions in the database as well as the actual data for each record (each questionaire)? Should I be referencing the database to populate all of my questions on my VB form or should I manually put labels and combo boxes containing the questions and possible answers on my form? Or should I be using another technology to store my questions and conditions OR my results, such as XML?

I looking for suggestions. I want to optimize my program as much as possible. I don't want to slow it down by making several calls to the database, but I want to make sure I'm also taking away optimization by hardcoding everything.

Should I store the questions along with the list of possible answers and their corresponding conditions in the database as well as the actual data for each record (each questionaire)? Should I be referencing the database to populate all of my questions on my VB form or should I manually put labels and combo boxes containing the questions and possible answers on my form?

I would always choose storing reference data in a database over hard-coding in the application.

thanks for responding. i had a feeling that would be the best option. i'm still a bit confused on how to logically put everything in the database.

MORE INFO:

Picture an application with an explorer style view. On the left in folders are different sections of a questionaire. On the right side will be the corresponding questions to that section. Each section, each question and it's corresponding possible answers, the controls that they will be held in (VB) will all need to be in the database. I'm still confused on how to setup tables relating each part...There is the data that will be stored to set up the screen, then there is data that will be stored for each record (each questionaire's answers, so to speak).

i think i was thinking too much. Seeing your code example has helped me clear up a lot. Thank you!...I was adding in a bunch of tables that didn't need to be there. The structure above makes a lot more sense, and will work with all of the lookup tables that I'll need. Again Thank you!...it always helps to have another set of eyes looking at the same issue.