ASP.NET 在線考試系統實現步驟

一、版本頁面

VS2010+SqlServer2008R2
登陸頁面
數據庫頁面

二、實現功能

1.  用戶註冊登錄
2.  兩種身份:管理員(普通管理員與超級管理員)和考生
3.  普通管理員能夠修改學生與查看考試信息
4. 超級管理館能夠更改考試信息
5.  讀者查看自己的信息,參加考試

三、主要頁面展示

1.登陸頁面
登陸頁面
2.考生進入
考生進入
3.考生考試考生考試
4.成績查詢
成績查詢
5.錯題查看
錯題查看
6.管理員頁面(分超級管理員與普通管理員,權限不同)
管理員頁面
7.學生添加
學生添加
8.題庫添加
題庫添加
9.試卷生成與管理
試卷生成與管理
10.成績管理
成績管理

四、簡單代碼

1.登陸

 if (cx.Text.ToString().Trim() == "管理員")
        {
            sql = "select * from allusers where username='" + TextBox1.Text.ToString().Trim() + "' and pwd='" + TextBox2.Text.ToString().Trim() + "'";
        }
        if (cx.Text.ToString().Trim() == "學生")
        {
            sql = "select * from xueshengxinxi where xuehao='" + TextBox1.Text.ToString().Trim() + "' and mima='" + TextBox2.Text.ToString().Trim() + "' ";
        }
        DataSet result = new DataSet();
        result = new Class1().hsggetdata(sql);
        // result = new TestOnline.Class1().hsggetdata(sql);
        if (result != null)
        {
            if (result.Tables[0].Rows.Count > 0)
            {
                Session["username"] = TextBox1.Text.ToString().Trim();

                if (cx.Text.ToString().Trim() == "管理員")
                {
                    Session["cx"] = result.Tables[0].Rows[0]["cx"].ToString().Trim();
                }
                else
                {
                    Session["cx"] = cx.Text.ToString().Trim();
                    Session["xm"] = result.Tables[0].Rows[0]["xingming"].ToString().Trim();
                    Session["bj"] = result.Tables[0].Rows[0]["banji"].ToString().Trim();
                }


                Response.Redirect("main.aspx");
            }
            else
            {
                Response.Write("<script>javascript:alert('對不起,用戶名或密碼不正確!');history.back();</script>");
            }
        }

2.在線考試

  if (result != null)
            {
                if (result.Tables[0].Rows.Count > 0)
                {

                    nshijuanbianhao = result.Tables[0].Rows[0]["shijuanbianhao"].ToString().Trim();
                    nxuanzetishu = result.Tables[0].Rows[0]["xuanzetishu"].ToString().Trim();
                    nxuanzetifenzhi = result.Tables[0].Rows[0]["xuanzetifenzhi"].ToString().Trim();
                    nxuanzeti = result.Tables[0].Rows[0]["xuanzeti"].ToString().Trim();
                    npanduantishu = result.Tables[0].Rows[0]["panduantishu"].ToString().Trim();
                    npanduantifenzhi = result.Tables[0].Rows[0]["panduantifenzhi"].ToString().Trim();
                    npanduanti = result.Tables[0].Rows[0]["panduanti"].ToString().Trim();
                    ntiankongtishu = result.Tables[0].Rows[0]["tiankongtishu"].ToString().Trim();
                    ntiankongtifenzhi = result.Tables[0].Rows[0]["tiankongtifenzhi"].ToString().Trim();
                    ntiankongti = result.Tables[0].Rows[0]["tiankongti"].ToString().Trim();
                }
            }

            sql = "select * from xuanzeti where id in (" + nxuanzeti + ") ";
            //DataSet result = new DataSet();
            result = new Class1().hsggetdata(sql);
            if (result != null)
            {
                if (result.Tables[0].Rows.Count > 0)
                {

                    DataList1.DataSource = result.Tables[0];
                    DataList1.DataBind();

                }
                else
                {
                    DataList1.DataSource = null;
                    DataList1.DataBind();
                }
            }

            sql = "select * from panduanti where id in (" + npanduanti + ") ";
            //DataSet result = new DataSet();
            result = new Class1().hsggetdata(sql);
            if (result != null)
            {
                if (result.Tables[0].Rows.Count > 0)
                {

                    DataList2.DataSource = result.Tables[0];
                    DataList2.DataBind();

                }
                else
                {
                    DataList2.DataSource = null;
                    DataList2.DataBind();
                }
            }

3.成績查詢(簡單綁定)

if (!IsPostBack)
        {
            string sql;
            sql = "select * from chengji where xh='" + Session["username"].ToString().Trim()+ "' order by id desc";
            getdata(sql);
        }

五、總結

已經做了很多的項目了,這個考試系統比較完善,對數據的增刪改查都比較到位,需要直接加我(不白給)1076396021
直接跳轉

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章