I'm trying to write an exam with multiple choice and true/false questions. I use the repeater to populate the questions answers but having trouble storing the user's answer to my sql database.
Any advice on the logic or what I should use, in term of coding, to do this would be greatly appreciated.
I tried View State but got no luck.
So with that said - most controls do not have any kind of automatic connection and interface to a database. You will need to get the data out of your display and then upload it to a database using a connector.
Read this article:
[link=http://msdn.microsoft.com/en-us/library/ms998300.aspx]how to connect to an sql database[/link]
this will show you how to connect using a connection string, create an sql command and execute a statement.
I'm assuming you are familiar with sql since you already have a DB set up? (sorry it's hard to tell from a post what someone's skill level is)
I have a db with all test questions and answer choices for an exam. I am able to access the database to pull out the questions and answer choices to display to the users. However, after the users take the test and click on the submit button, nothing get send to the database. I got an error message as if the users never selected a single answer. My problem is that I have nothing to save to the database. I'm not sure why even tho users have selected the answers but as soon as the submit button clicked no values were there.
(Sorry, I took so long to reply. I had been busy)
My ASP is rusty atm - and since I'm not familiar with the control you are using my advice may not be the best solution for you so hopefully another poster can step in - otherwise -
I guess would be to set up an event on the radio buttons - or whatever - and assign values to page variables so that on submit they are passed to your next page.