日期:2014-05-16  浏览次数:20493 次

在线考试系统随机抽题如何实现自动评分。
下了ASP.NET项目开发案例全程实录(第二版)用了里面的在线考试系统,发现题目不是随机抽取的,用了select top 20  * from  表名order by newid()随机抽题后不知道怎么算成绩,求教。。。
这是原来的代码( 计算成绩foreach语句下面的也看不懂求教):
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class QianUser_StartExamfra : System.Web.UI.Page
{
    Datacon dataconn = new Datacon();
    static int int_row1 = 0;//单选题题号索引
    static int int_row2 = 0;//多选题题号索引
    static int int_row1Point = 0;//单选题分数
    static int int_row2Point = 0;//多选题分数
    //============页面加载事件,从数据库中提取题目================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.getCom(1);
            this.getCom(2);
        }
    }
    //=========================提交试卷===========================
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int_row1 = 0;//单选题题号索引
        int_row2 = 0;//多选题题号索引
        int_row1Point = 0;//单选题分数
        int_row2Point = 0;//多选题分数
        //try
        //{
            Label3.Visible = Label4.Visible = Label7.Visible = Label8.Visible = Label9.Visible = Label10.Visible = true;
            this.lblStuID.Text = Session["StuName"].ToString();
            this.lblSubject.Text = Session["SelLession"].ToString();
            this.lblQuestion.Text = Session["SelTitle"].ToString();
            this.getCom(3);
            this.getCom(4);
            this.lblTotal.Text = Convert.ToString(int_row1Point + int_row2Point);
            dataconn.eccom("insert into tb_StuResult"
                     + "(stu_id,which_lesson,taotiid,taotiname,res_single,res_more)"