Using ASP. NET to build an online examination system

Source: Internet
Author: User

With the popularization of computer networks, the database-based B/S online examination system has been widely used. Now we use ASP.net (C #) + SQL server (or ACCESS) for example, describe how to develop an online examination system.
I. Database Design:
Create a database netexam, add StuInfo to the database, and create the following fields: Examination ID (c) (Primary Key), Name (c), and whether to log on to LogYn (c), Score (c), randomly generated Question Answer mca (c) (Note: here we use multiple choice questions as an example. The same applies to single choice questions and complex questions ). Add the multi-choice question bank table mc and create the following fields: question (c), four choices choice1 (c), choice2 (c), choice3 (c), choice4 (c) answer (c ).
Ii. Login of candidates:
Insert the examinee information to the StuInfo table here to prevent repeated logins! Specify a unique question mark and set the question mark field ExamId (c) as the primary key. When you log on again, Catch the error and give the corresponding prompt. Some codes are as follows (login. aspx ):
Private void ButOk_Click (object sender, System. EventArgs e)
{
...
SqlConnection StuConn = new SqlConnection ("Data Source = localhost; Integrated Security = SSPI;
Initial Catalog = netexam ");
SqlCommand LoginCmd = StuConn. CreateCommand (); // You can select different database connections based on different situations.
...
LoginCmd. commandText = "Insert into StuInfo (ExamId, Name) values ('" + TxtId. text. trim () + "','" + TxtName. text. trim () + "')";
// Insert the test number and name into the corresponding fields. TxtId and TxtName are the text boxes that enter the test number and name respectively.
Try
{
...
Session ["Id"] = TxtId. Text. Trim ();
StuConn. Open ();
LoginCmd. ExecuteReader ();
Response. Redirect ("test. aspx ");
}
Catch (Exception) // catch the corresponding error
{
Response. Write ("<script language =" javascript ">" + "");

Related Article

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.