.NET General

Moderators: None (Apply to moderate this forum)
Number of threads: 797
Number of posts: 1359

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How do I caputer user's responses and send them to an "sql" database Posted by superiorcaine on 29 Apr 2009 at 8:01 PM
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.
Report
Re: How do I caputer user's responses ... Posted by Psightoplazm on 30 Apr 2009 at 7:40 AM
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:
how to connect to an sql database

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)

></\/~Psightoplasm`~
Report
Re: How do I caputer user's responses ... Posted by superiorcaine on 10 May 2009 at 1:22 AM
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)
Report
Re: How do I caputer user's responses ... Posted by Psightoplazm on 10 May 2009 at 6:48 PM
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.
></\/~Psightoplasm`~
Report
Re: How do I caputer user's responses ... Posted by superiorcaine on 10 May 2009 at 9:08 PM
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!



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.