Confused myself!

  • Thread starter Thread starter leonaisse
  • Start date Start date
L

leonaisse

Hi All

I need your help please, i've been thinking about this one for so long I
have confused myself!

I have a web app that contains a clients table in SQL server.

When a new client is entered onto the system I want to take all the usual
details(already complete) and on the next page I have 135 questions which
could warrant a yes, no or not asked answer and store the answers to the 135
questions in a DB table linked to the customer.

What is the quickest way for me to code this page and the best DB structure
to do this. I have the 135 questions in a DB table also.

Thanks

Leon
 
I would store all of the results in to one column of type varchar(135)
rather than creating 135 separate columns for each answer (if that many
is even possible) and use one character per answer e.g. 0 = yes, 1 = no
and 2 = not asked.
As for inputting the answers, I guess a datagrid might be the easiest
way.
 
matt urbanowski said:
I would store all of the results in to one column of type varchar(135)
rather than creating 135 separate columns for each answer (if that many
is even possible) and use one character per answer e.g. 0 = yes, 1 = no
and 2 = not asked.
As for inputting the answers, I guess a datagrid might be the easiest
way.

Since the op has the questions in a table, he could create another table
that has the customer's id, question id, and answer. This way, there would
be one row per question per customer and a lookup is much easier for any of
the three (question, customer, or answer) using basic sql and no parsing of
the text would be required.

For the UI, you should be able to easily use a repeater control by fetching
the questions from the database and populating the "answers" in the repeater
by fetching the data from the "question, customer, and answer" table.
Relationships are your friend.

HTH,
Mythran
 
Leonaisse,

Most probably would I use as well that string of char that the others
describe.

Probably is than the most simple to use a datalist and use in that the
indexer from that char string to bind.

Not tested.

Cor
 
Leon,

Storing the answers in a 135 character string would be the simplest,
but if you want any kind of data mining capabilities you'll need one
row per answer.

Brian
 
Back
Top