Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Note: When asp.net + sqlserver2000 is used, the question is only for multiple choice questions.
I. Database design
1. There is a table in the question.
Fields include: ID (ID field), question content, and answer
2. An option exists in a table.
Fields include: ID (ID field), Question ID, and display order
II. Page design
The personnel will not talk about the login or anything, but the key point is to talk about the problem.
1. If questions are randomly asked, you can use order by newid () when querying questions in the database ()
For example, select * from tablename order by newid ()
After reading the question, search for the question option in the option table based on the question ID, and then bind it. At the same time, you need to read the answer and bind it to the page.
If the option is single-choice, you can bind a radiobuttonlist, and use checkboxlist for the check.
After binding, a session ["time"] is generated to save the time DateTime. Now ().
2. if the question is fixed and the answer to each question is the same, it is best to put the question and option in static display on the page, or read the question and option from the database and put it in a static variable (for example: APPLICATION), which greatly improves the efficiency and reduces the pressure on the server.
3. Record the submission time during submission and subtract from the session ["time"] generated on the page to obtain the answer time. Compare the submitted answers with the standard answers saved on the page, calculate the correct answer rate and the number of correct answers, and save the answers to the database together with the answer time.
Function CheckItem ()
Alchk = 0; // used to save the number of answers
For (k = 0; k <44; k ++) // 44 indicates there are 44 questions
Chkc = 0; // There are several choices in the answer to each question. Here I use checkbox. If radiobottonlist is used, only one choice is allowed.
For (j = 0; j <4; j ++) // 4 indicates that each question has four options.
Strid = 'dlquestion _ ctl '+ k +' _ dlSelection _ ctl '+ j +' _ ckSelection '; // obtain the ID of the option on the page
If (document. getElementById (strid). checked) // if selected
If (chkc> 1) // indicates more than one option
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.