How do I caputer user's responses and send them to an "sql" database

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.


  • I'm not familiar with the repeater control - but from what I understand it's comparable with a datagrid or datatable but more flexible with its display.

    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=]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)

  • Thank you for the feedback. Yes, I know how to code the connection to sql database. I already have this part done. This is how I am able to populate the questions and answer choices for the exam. Perhaps, I was unclear with my question...

    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)
  • Ah - ok - sorry I was so way off.
    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.
  • Yeah, I asked a friend and he said the same thing. I should look into page event/page life cycle or view state. I must have done something wrong because it didn't work. Oh well, I'll do some more reading on this or hopefully another poster can help me out. I appreciate your time. Thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!