数据库在线考试系统课程设计论文.docx
- 文档编号:10511753
- 上传时间:2023-02-17
- 格式:DOCX
- 页数:18
- 大小:280.76KB
数据库在线考试系统课程设计论文.docx
《数据库在线考试系统课程设计论文.docx》由会员分享,可在线阅读,更多相关《数据库在线考试系统课程设计论文.docx(18页珍藏版)》请在冰豆网上搜索。
数据库在线考试系统课程设计论文
湖北大学本科课程设计
题目数据库在线考试系统
学院数学与计算机科学学院
姓名刘欢学号2010221104210009
专业年级2010级计算机科学与技术
指导教师马传香职称教授
2013年1月3日
数据库在线考试系统
摘要
本系统是一个数据库在线考试系统,它是利用微软的与visualstudio平台和SQLserver2008数据库软件编写的网络考试系统,主要实现学生在线考试功能。
A由微软的.net技术细化而来,采用visualstudio2010作为可视化开发环境,具有更强的灵活性,执行效率更高。
SQLServer是由Microsoft开发和推广的关系数据库管理系统(DBMS),本系统采用的SQLserver2008是至今为止的最强大最全面的SQLServer版本。
关键词:
SQLserverC#在线考试
一、需求分析
本系统主要用作学生通过网上登录,实现在线考试,成绩查看,密码修改等功能。
(1)首先要设置学生的信息,让学生可以通过学号和密码登入系统;
(2)学生登入系统后,可以点击在线考试,进入考试界面,可以选择章节及难度进行随机选题,开始考试。
(3)考试完成后,学生可以提交试卷,并得出成绩;
(4)学生可以通过成绩查询功能查看自己测试过后的任一次成绩记录;
(5)学生可以修改自己的密码。
二、数据库设计
针对以上的系统需求,我们利用SQLserver2008建立了Exam数据库。
其中应包括以下四张表:
Student,score,selectquestion,blankquestion。
Student表是学生信息表,主要包括学生的姓名,学号,和密码;
score表是学生成绩表,主要包括学生的姓名,学号,成绩,测试时间,难度,单元;
selectquestion表是选择题表,包括序号,问题,选项,单元,难度,答案;
blankquestion表是填空题表,包括序号,问题,单元,难度,答案;
Student(Studentid,Studentname,Password)
Score(id,Studentid,Studentname,score,testtime,difficulty,unit)
Selectquestion(id,question,A,B,C,D,unit,difficulty,answer)
blankquestion(id,question,unit,difficulty,answer)
下面是数据库创建的具体内容:
(实验截图)
Student表:
Score表:
Selectquestion表:
Blankquestion表:
EXAM数据库:
三、功能设计
设计好数据库后,接下来就是要编写代码实现具体的功能。
1、学生登录功能
学生输入学号和密码后,通过与后台数据库数据的比较,若匹配,则登入系统;否则,给出错误提示。
具体代码:
2、学生在线考试及打分功能
学生点击在线考试,然后选择难度和章节,开始考试,点击提交之后,系统会根据你选择的答案与数据库的正确答案进行比较,然后进行打分,正确答案和成绩会在卷面上显示出来。
具体代码:
开始考试:
protectedvoidbtnbegin_Click(objectsender,EventArgse)
{
Label7.Visible=true;
Label8.Visible=true;
submit.Visible=true;
btnbegin.Enabled=false;
DropDownList1.Enabled=false;
DropDownList2.Enabled=false;
if(DropDownList1.SelectedValue=="期末")
{
DataList2.Visible=true;
DataList4.Visible=true;
}
else
{
DataList1.Visible=true;
DataList3.Visible=true;
}
}
提交试卷:
protectedvoidsubmit_Click(objectsender,EventArgse)
{
Labellbl1,lbl2;
intgrade=0;
stringanswer="";
RadioButtonradA,radB,radC,radD;
Labeltemp,temp1;
TextBoxtxtanswer;
if(DropDownList1.SelectedValue=="期末")
{
foreach(DataListItemdsinDataList2.Items)
{
lbl1=(Label)ds.FindControl("Labelanswer");
lbl1.Visible=true;
lbl2=(Label)ds.FindControl("answerLabel");
lbl2.Visible=true;
radA=(RadioButton)ds.FindControl("RadioA");
radB=(RadioButton)ds.FindControl("RadioB");
radC=(RadioButton)ds.FindControl("RadioC");
radD=(RadioButton)ds.FindControl("RadioD");
if(radA.Checked)
answer="A";
else
if(radB.Checked)
answer="B";
else
if(radC.Checked)
answer="C";
else
if(radD.Checked)
answer="D";
if(answer.ToString().Trim()==lbl2.Text.Trim())
grade+=5;
}
foreach(DataListItemdsinDataList4.Items)
{
temp=(Label)ds.FindControl("Label11");
temp.Visible=true;
temp1=(Label)ds.FindControl("AnswerLabel");
temp1.Visible=true;
txtanswer=(TextBox)ds.FindControl("txtanswer");
if(temp1.Text.Trim()==txtanswer.Text.Trim())
grade+=5;
}
}
else
{
foreach(DataListItemdsinDataList1.Items)
{
lbl1=(Label)ds.FindControl("Labelanswer");
lbl1.Visible=true;
lbl2=(Label)ds.FindControl("answerLabel");
lbl2.Visible=true;
radA=(RadioButton)ds.FindControl("RadioA");
radB=(RadioButton)ds.FindControl("RadioB");
radC=(RadioButton)ds.FindControl("RadioC");
radD=(RadioButton)ds.FindControl("RadioD");
if(radA.Checked)
answer="A";
else
if(radB.Checked)
answer="B";
else
if(radC.Checked)
answer="C";
else
if(radD.Checked)
answer="D";
if(answer.ToString().Trim()==lbl2.Text.Trim())
grade+=5;
}
foreach(DataListItemdsinDataList3.Items)
{
temp=(Label)ds.FindControl("Label9");
temp.Visible=true;
temp1=(Label)ds.FindControl("AnswerLabel");
temp1.Visible=true;
txtanswer=(TextBox)ds.FindControl("txtanswer");
if(temp1.Text.Trim()==txtanswer.Text.Trim())
grade+=5;
}
}
examTableAdapters.scoreTableAdaptersa=newexamTableAdapters.scoreTableAdapter();
sa.Insertscore(Convert.ToInt64(Session["Studentid"].ToString()),Session["Studentname"].ToString(),grade,DateTime.Now,DropDownList2.SelectedValue,DropDownList1.SelectedValue);
lblgrade.Text=grade.ToString();
}
}
成绩查询代码:
protectedvoidbtninqry_Click(objectsender,EventArgse)
{
GridView1.DataSourceID=null;
examTableAdapters.scoreTableAdaptersa=newexamTableAdapters.scoreTableAdapter();
if(DropDownList1.SelectedValue=="全部")
{
GridView1.DataSource=sa.GetDataBystudentid(Convert.ToInt64(Session["Studentid"].ToString()));
GridView1.DataBind();
}
else
{
GridView1.DataSource=ObjectDataSource1;
GridView1.DataBind();
}
}
密码修改代码:
protectedvoidtxtchange_Click(objectsender,EventArgse)
{
if(txtpwd.Text!
=""&&txtnewpwd.Text!
="")
{
examTableAdapters.StudentTableAdaptersa=newexamTableAdapters.StudentTableAdapter();
sa.Updatepassword(txtnewpwd.Text,Convert.ToInt64(Session["Studentid"]));
Page.ClientScript.RegisterStartupScript(Page.GetType(),"succ","");
}
else
{
Page.ClientScript.RegisterStartupScript(Page.GetType(),"succ","");
}
}
以下是本系统采用的数据集及相关SQL语句:
学生表:
SELECTStudentname,Studentid,Password
FROMStudent
WHERE(Studentid=@Studentid)AND(Password=@Password)
SELECTStudentname,Studentid,Password
FROMStudent
WHERE(Studentid=@Studentid)
成绩表:
SELECTid,Studentid,Studentname,score,testtime,difficulty,unit
FROMscore
WHERE(unit=@Param1)AND(Studentid=@Param2)
SELECTid,Studentid,Studentname,score,testtime,difficulty,unit
FROMscore
WHERE(Studentid=@Param1)
INSERTINTOscore
(Studentid,Studentname,score,testtime,difficulty,unit)
VALUES(@Studentid,@Studentname,@score,@testtime,@difficulty,@unit)
选择题表:
SELECTTOP
(1)id,Question,A,B,C,D,answer
FROM(SELECTTOP(100)id,Question,A,B,C,D,unit,difficulty,answer
FROMselectquestion
WHERE(unit='第一单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_1
UNION
SELECTTOP
(1)id,Question,A,B,C,D,answer
FROM(SELECTTOP(100)id,Question,A,B,C,D,unit,difficulty,answer
FROMselectquestionASselectquestion_3
WHERE(unit='第二单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_2
UNION
SELECTTOP
(2)id,Question,A,B,C,D,answer
FROM(SELECTTOP(100)id,Question,A,B,C,D,unit,difficulty,answer
FROMselectquestionASselectquestion_2
WHERE(unit='第三单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_3
UNION
SELECTTOP
(2)id,Question,A,B,C,D,answer
FROM(SELECTTOP(100)id,Question,A,B,C,D,unit,difficulty,answer
FROMselectquestionASselectquestion_1
WHERE(unit='第四单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_4
SELECTA,B,C,D,Question,answer,difficulty,id,unit,answerASExpr1
FROMselectquestion
WHERE(unit=@Param1)AND(difficulty=@Param2)
ORDERBYNEWID()
填空题表:
SELECTTOP
(1)id,question,answer
FROM(SELECTTOP(100)id,question,answer,unit,difficulty
FROMblankquestion
WHERE(unit='第一单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_1
UNION
SELECTTOP
(1)id,question,answer
FROM(SELECTTOP(100)id,question,answer,unit,difficulty
FROMblankquestionASblankquestion_3
WHERE(unit='第二单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_2
UNION
SELECTTOP
(1)id,question,answer
FROM(SELECTTOP(100)id,question,answer,unit,difficulty
FROMblankquestionASblankquestion_2
WHERE(unit='第三单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_3
UNION
SELECTTOP
(1)id,question,answer
FROM(SELECTTOP(100)id,question,answer,unit,difficulty
FROMblankquestionASblankquestion_1
WHERE(unit='第四单元')AND(difficulty=@Param1)
ORDERBYNEWID())ASderivedtbl_4
SELECTid,question,answer,unit,difficultyASExpr1
FROMblankquestion
WHERE(unit=@Param1)AND(difficulty=@Param2)
ORDERBYNEWID()
四、前台界面设计
关于前台界面设计,主要是使用的是CSS+DIV的技术,这样可以便于界面代码的修改,使界面看起来简洁清爽。
下面是截取相关界面效果图:
1、登陆界面
2、在线考试
3、成绩查询:
4、密码修改:
五、感悟与总结
通过对本系统的设计到功能实现,提高了我的动手能力,使我加深了对数据库相关概念及工具的使用。
但是,由于时间比较仓促,本系统还有许多不完善之处,比如说:
功能比较简单,只是实现了老师要求的基本功能;界面设计比较简单,没有在这方面多下些功夫,等等。
总体来说,在这次在线考试系统的设计制作中,我还是有较多的收获的。
参考文献:
[1]蒋瀚洋李月军庞亚娟:
SQLServer2005数据库管理与开发教程人民邮电出版社
[2]王珊萨师煊:
数据库系统概论(第四版)高等教育出版社
[3]崔淼关六三彭伟:
ASP.NET程序设计教程(C#版)机械工业出版社
湖北大学本科课程设计成绩评定表
项目
权重
分值
具体要求
得分
文献阅读与调查论证
0.20
100
能独立查阅文献和从事其它调研;有收集、加工各种信息的能力
论文撰写质量
0.40
100
设计合理、理论分析与计算正确,实验数据准确可靠;有较强的实际动手能力、经济分析能力和计算机应用能力;设计说明书完全符合规范化要求,用A4复印纸打印成文
学习态度
0.30
100
学习态度认真,科学作风严谨,严格按要求开展各项工作,按期完成任务
学术水平与创新
0.10
100
设计有创意,有一定的学术水平或实用价值
总分
评语:
等级:
指导教师:
年月日
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据库 在线 考试 系统 课程设计 论文
![提示](https://static.bdocx.com/images/bang_tan.gif)