views:

236

answers:

2

i have 10 radio buttons that have yes/no values. These are options to one question, so need to in the database under 1 record. so - question1 yes, question 1 no, question1 yes and so on. i want to use a while loop or some other loop to take all these values and insert them or update them in the database for that particular question. any ideas. i m new to programming. the db table is ID, question, Answer. so it will be 1 question1 yes, 2 question1 yes, 3 question1 no.

A: 

It depends on your database design. I would suggest each question and answer to be one row in the table. In the while loop, you just have to treat each answer/question pair as one row and use an INSERT on them.

Extrakun
+1  A: 

You are new, so this might help you when you are a little more confident, but one thing you can do is create an Array of the radio buttons in your codebehind. You can then iterate through the array of radiobuttons to pull their information into your database.

However, it would probably be best if you just hard coded the insert if the radio buttons won't be changing.

C Bauer