数据库课程设计报告-通用学生信息管理系统.doc_第1页
数据库课程设计报告-通用学生信息管理系统.doc_第2页
数据库课程设计报告-通用学生信息管理系统.doc_第3页
数据库课程设计报告-通用学生信息管理系统.doc_第4页
数据库课程设计报告-通用学生信息管理系统.doc_第5页
已阅读5页,还剩35页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

成绩数据库课程设计课程名称 数据库课程设计 题目名称 通用学生信息管理系统 学生学院 计算机学院 专业班级 网络开发2班 学 号_ _学生姓名_ _指导教师 2010年5月25日广东工业大学课程设计任务书题目名称通用学生信息管理系统学生学院计算机学院专业班级网络开发2班姓 名学 号一、课程设计的内容1研究学生信息管理系统在实际的应用和意义。2学习使用sql server2000 vc+的实际使用,odbc驱动程序的应用和对服务器的配置等!3创建数据库,将其与vc+连接进行增删改查的功能,并而设计登录界面,对不同的用户设计不同的权限等!4编写课程设计的报告!二、课程设计的要求与数据1学生基本情况数据:学号,姓名,性别,年龄,状态,电话和地址。2用户数据:登录名,状态,密码和权限。3教师数据:教师号,教师名,状态,年龄,性别。4课程表数据:课程号,课程名,课时,学分和状态。5成绩数据:课程号,学生号,课程成绩,状态。6教学数据:课程号,老师号。三、课程设计应完成的工作开发一个用vc+技术的通用学生信息管理系统,主要功能包括:用户登录,用户管理,学生教师管理,成绩管理,数据维护,成绩查询,学生查询,授课管理,授课查询,课程管理等。四、课程设计进程安排序号设计(论文)各阶段名称地点起止日期1选定本次课程设计及其论文的研究课题宿舍11周星期四2对研究课题进行调查并做出详细的需求分析宿舍12周星期日3收集资料和参考文献图书馆12周星期三4认真阅读和学习资料、文献并做出初步构思宿舍12周星期五5制定出整个系统的设计构想、设计思路和方法宿舍12周星期六6进行系统的设计、开发和编写程序代码宿舍13周星期一至四7对系统进行测试和系统调试宿舍13周星期五六8完成整个系统的开发并进行系统维护宿舍13周星期日9撰写设计论文宿舍14周星期一10最终完成系统修改、论文撰写和表格填写宿舍14周星期二11上交课程设计、论文及表格教学楼6.6五、应收集的资料及主要参考文献1王珊.数据库系统概论.北京:高等教育出版社,20072程展鹏.vc+.北京:清华大学出版社,2005.3 李华. visual c + 教程m.北京:机械工业出版社,2007.发出任务书日期:2010年 5月15 日 指导教师签名:计划完成日期: 2010年 6月 5 日 基层教学单位责任人签章: 主管院长签章:一、相关技术介绍41后台数据库42前台开发工具4二、需求分析51权限表52数据字典63数据流图6三、概念结构设计7四、逻辑结构设计71系统的逻辑关系图72具体的表的数据结构83系统结构图9五、数据库模块设计101系统结构图102数据库关系图103用户界面11六、数据库实施121数据库的创建122数据库的备份133用户界面设计与关键代码14七、系统测试方案和测试报告291学生管理模块测试292成绩管理模块测试303课程管理模块测试314教师管理模块测试325授课管理模块测试32八、系统的主要功能和使用33九、系统安装说明33十、个人总结34参考文献34一、相关技术介绍1后台数据库sql全称是“结构化查询语言(structured query language)”,sql server是一种使用传统的transact-sql语言,基于客户机/服务器,并且两者间传送请求和答复的关系型数据库管理系统。sql server使用客户机/服务器体系结构将所有的工作分解为客户机和服务器任务,由两者分别完成。sql server 2000是microsoft公司于2000年8月推出的最新数据库引擎,作为大型电子商务,数据仓库的数据库解决方案,它具有一下几个特点:1 熟悉的界面sql server2000与sql server 7.0就界面而言并没有太大的差别,相信许多曾经使用过sql server 7.0的读者见到2000时就会有一种十分熟悉的感觉,就方便了用户从7.0版本到2000的升级。2 更加强大的数据引擎sql server2000拥有增强的数据引擎,高级的管理方式,这样就大大降低了检索的开销。此外sql server2000支xml,http,并与web相结合,使其功能更加强大。3与windows更好地结合。2前台开发工具vc+是微软公司开发的一个ide(集成开发环境),换句话说,就是使用c+的一个开发平台.有些软件就是这个编出来的.另外还有vb,vf.只是使用不同语言.但是,vc+是windows平台上的c+编程环境,学习vc要了解很多windows平台的特性并且还要掌握mfc、atl、com等的知识,难度比较大。windows下编程需要了解windows的消息机制以及回调(callback)函数的原理;mfc是win32api的包装类,需要理解文档视图类的结构,窗口类的结构,消息流向等等;com是代码共享的二进制标准,需要掌握其基本原理等等。 vc作为一个主流的开发平台一直深受编程爱好者的喜爱,但是很多人却对它的入门感到难于上青天,究其原因主要是大家对他错误的认识造成的,严格的来说vc+不是门语言,虽然它和c+之间有密切的关系,如果形象点比喻的话,可以c+看作为一种”工业标准”,而vc+则是某种操作系统平台下的”厂商标准”,而”厂商标准”是在遵循”工业标准”的前提下扩展而来的。vc+应用程序的开发主要有两种模式,一种是win api方式,另一种则是mfc方式,传统的win api开发方式比较繁琐,而mfc则是对win api再次封装,所以mfc相对于win api开发更具备效率优势,但为了对windows开发有一个较为全面细致的认识,笔者在这里还是以讲解win api的相关内容为主线。二、需求分析学生信息管理系统是各所高校教育环节不可缺少的一部分,它的内容对学校的决策者和管理者来说至关重要,所以该系统应该能够为用户提供充足的信息和快捷的查询手段。但一直以来人们使用传统人工方式管理文件档案,这种管理方式存在着许多缺点,如:效率低、保密性差,另外时间一长,将产生大量的文件和数据,这对于查找、更新和维护都带来了不便。随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深刻认识,他已进入人类社会的各个领域并发挥着越来越重要的作用。早期的校园网络、如今的web宽带网都为我们共享数据提供了前所未有的方便,由此,建立高性能的学生信息管理系统,作为计算机应用的一部分,使用计算机对学生信息管理,具有手工管理无法比拟的优点,如:检索迅速、查找方便、可靠性高、存储量大、保密性好、寿命长、成本低等,这些优点能够极大的提高学生信息管理的效率,也是科学化、正规化的体现。因此,开发这样的软件系统是很必要的。1权限表学生信息管理系统的主要功能是为是实现对学生的管理,包括增加,删除,修改,查询等。方便日常教学工作,提高管理的效率,而且要确保其信息安全!所以系统设计了三种不同的用户:学生,教师,管理员。他们的权限如下图所示:修改密码用户管理学生管理教师管理课程管理授课管理成绩管理成绩查询授课查询学生教师管理员权限图具体的功能分析如下:系统登录:程序一开始就是登录,用户输入用户名和密码,系统会通过查询数据库进行验证,不正确就重新登录,正确就能进入;登录后根据权限给予功能!修改密码:用户都可以修改自己的密码。用户管理:只有管理员才有这个功能,可以增加,删除,修改,用户属性。成绩查询:用户可以根据权限,使用这功能,可以按姓名或课程来查询,还可能以分数进行查询,方便用户使用。授课查询:可以查某老师的课程或某课程的老师名。学生管理:可以对学生的信息进行增加,删除,修改,功能。成绩管理:可以对成绩进行增加,删除,修改,功能。教师管理:可以对老师的信息进行增加,删除,修改,功能。课程管理:对课程的基本信息进行添加,删除,修改等操作。2数据字典(1)学生数据:学生编号,学号,姓名,性别,年龄,状态,电话和地址(2)用户数据:用户编号,登录名,状态,密码和权限(3)教师数据:教师编号,教师号,教师名,状态,年龄,性别和权限(4)课程表数据:课程编号,课程号,课程名,课时,学分和状态(5)成绩数据:课程号,学生号,课程成绩,状态其中,多个学生由一个老师教授课程,多个老师教授一个学生。多个老师教授一门课程,多门课程也可由一个老师兼任。学生可选修多门课程,一门课程也可多个学生一起选修。因此这三个实体都是多对多的关系。3数据流图数据流图三、概念结构设计e-r图四、逻辑结构设计1系统的逻辑关系图userinfo(login_id,login_name,login_password,login_level,login_status);teach(teach_id,course_no,teache_no,teache_status);student(student_id,student_no,student_name,student_sex,student_age, student_phone, student_address, student_status)teacher(teacher_id,teacher_no,teacher_name,teacher_sex,teacher_age,teacher_status)course(course_id,course_no,course_name,course_hour,course_credit,course_status)score(score_id, student_no, course_no, score_result, score_status)2具体的表的数据结构列 名数据类型长 度备 注login_idsmallint2主键,非空login_namevarchar50非空,用户名login_passwordvarchar50非空,口令login_levelvarchar5非空,权限login_statuschar2非空,状态用户表(userinfo)列 名数据类型长 度备 注teach_idint4非空,主键course_nochar5非空,外键,课程名teache_nochar10非空,外键,教师名teach_statuschar2非空,状态教学表(teach)列 名数据类型长 度备 注student_idint4主键,非空student_nochar10非空,学号student_namevarchar20非空,姓名student_sexchar2非空,性别student_agesmallint2非空,年龄student_phonevarchar20电话student_addressvarchar100地址student_statuschar2非空,状态学生表(student)列 名数据类型长 度备 注teacher_idint4主键,非空teacher_nochar10非空,教师号teacher_namevarchar20非空,教师名teacher_sexchar2性别teacher_agesmallint2非空,年龄teacher_statuschar2非空,状态教师表(teacher)列 名数据类型长 度备 注course_idint4非空course_nochar5非空,课程号course_namevarchar20非空,课程名course_hoursmallint2非空,授课时间course_creditnumeric5非空,学分course_statuschar2非空,状态课程表(course)列 名数据类型长 度备 注score_idint4非空,主键student_nochar10非空,外键,学号course_nochar5非空,外键,课程号score_resultsmallint2非空,成绩score_statuschar2非空,状态成绩表(score)3系统结构图视图五、数据库模块设计1系统结构图系统结构图2数据库关系图数据库关系图3用户界面用户登录界面:用户名:黄振龙 密码:3107006990进入后 基本界面:系统管理界面:基本信息管理界面:信息查询界面:帮助界面:六、数据库实施1数据库的创建(1)创建studentscore数据库create database studentscoreon( name = studentscore, filename = f:数据库课程设计studentscore.mdf, size = 4, filegrowth = 2);(2)创建用户表(userinfo)create table userinfo ( login_id smallint primary key clustered, login_name varchar(50) not null , login_password varchar(50) not null check(len(login_password)5), login_level varchar(5) not null, login_status char(2) default y check(login_status in(y,n) );(3)创建教师表(teacher)create table teacher( teacher_id int primary key clustered, teacher_no char(10) not null check(len(teacher_no)=10) unique, teacher_name varchar(20) not null, teacher_sex char(2) default 男 check(teacher_sex in(男 ,女), teacher_age smallint not null check(teacher_age2), teacher_status char(2) default y check(teacher_status in(y,n);(4)创建学生表(student)create table student(student_id int primary key clustered, student_no char(10) not null check(len(student_no)=10) unique, student_name varchar(20) not null, student_sex char(2) default 男 check(student_sex in(男 ,女), student_age smallint not null check(student_age2), student_phone varchar(20), student_address varchar(100), student_status char(2) default y check(student_status in(y,n);(5)创建课程表(course)create table course( course_id int primary key clustered, course_no char(5) not null check(len(course_no)=5) unique, course_name varchar(20) not null, course_hour smallint not null, course_credit numeric(2,1) not null, course_status char(2) default y check(course_status in (y,n);(6)创建教学表create table course( course_id int primary key clustered, course_no char(5) not null check(len(course_no)=5) unique, course_name varchar(20) not null, course_hour smallint not null, course_credit numeric(2,1) not null, course_status char(2) default y check(course_status in (y,n);(7)创建分数表reate table score( score_id int primary key clustered, student_no char(10) not null check(len(student_no)=10) , course_no char(5) not null check(len(course_no)=5) , score_result smallint not null check(score_result=0) and (score_result=100), score_status char(2) default y check(score_status in (y,n), foreign key(student_no) references student(student_no), foreign key(course_no) references course(course_no) );2数据库的备份关于数据库的备份,可以在另一台电脑上多建立一个数据库作为备份,对数据库的操作要同时对两个数据库的相同操作才可以进行!以后的灾难出现时也可以用另 一个数据库文件进行恢复!3用户界面设计与关键代码(1)用户登录界面如下39void clogindlg:onok() / todo: add extra validation herecstring username,password;m_strusername.getwindowtext(username); /获得输入的用户名m_strpassword.getwindowtext(password); /获得输入的密码if(!m_database.isopen() /判断数据库是否打开,打开返回true,否则返回falseif(m_database.open(_t(studentscore) /尝试打开数据库m_recordset.m_pdatabase = &m_database ;cstring strsql;strsql.format(select * from userinfo where login_name=%s and login_password=%s and login_status=y,username,password);m_recordset.open(crecordset:forwardonly,strsql);/打开记录集if(m_recordset.getrecordcount()=0)messagebox(密码错误,请重新输入!,密码错误,mb_ok | mb_iconwarning);m_strpassword.setwindowtext();m_strpassword.setfocus();elsem_recordset.getfieldvalue(login_level,m_userlevel);/获得数据库中用户的级别cdialog:onok();m_recordset.close();m_database.close();elsemessagebox(无法打开数据库!);void clogindlg:oncancel() / todo: add extra cleanup hereif(messagebox(真的要退出系统吗?,退出询问,mb_okcancel | mb_iconquestion)=idok)cdialog:oncancel();bool clogindlg:oninitdialog() cdialog:oninitdialog();m_strpassword.setwindowtext(123456789);m_strusername.setwindowtext(liao);return true; / return true unless you set the focus to a control / exception: ocx property pages should return falsevoid clogindlg:onsetfocusloginuser() m_strusername.setwindowtext();m_strpassword.setwindowtext();(2)基本信息管理(学生管理)void cstudentdlg:refreshlist()m_list.deleteallitems();m_studentset.open();m_studentset.m_strfilter = student_status=y;m_studentset.requery();for(int i=0;igetdlgitem(idc_student_female);p_maleradio = (cbutton*)this-getdlgitem(idc_student_male);m_badd.enablewindow(true);m_bdel.enablewindow(true);m_bedit.enablewindow(true);bool cstudentdlg:oninitdialog() cdialog:oninitdialog();/ todo: add extra initialization herem_list.insertcolumn(0,编号);m_list.insertcolumn(1,学号);m_list.insertcolumn(2,姓名);m_list.insertcolumn(3,性别);m_list.insertcolumn(4,年龄);m_list.insertcolumn(5,电话);m_list.insertcolumn(6,地址);rect rectlist;m_list.getwindowrect(&rectlist);m_list.setcolumnwidth(0,45);m_list.setcolumnwidth(3,45);m_list.setcolumnwidth(4,45);int othercolwidth = (rectlist.right-rectlist.left-4-45*3)/4;m_list.setcolumnwidth(1,othercolwidth);m_list.setcolumnwidth(2,othercolwidth);m_list.setcolumnwidth(5,othercolwidth);m_list.setcolumnwidth(6,othercolwidth);m_list.setextendedstyle(lvs_ex_fullrowselect);refreshlist();for(int j=0;jgetdlgitem(idc_student_female);p_maleradio = (cbutton*)this-getdlgitem(idc_student_male);resetbutton();return true; / return true unless you set the focus to a control / exception: ocx property pages should return falsevoid cstudentdlg:onclickliststudent(nmhdr* pnmhdr, lresult* presult) / todo: add your control notification handler code hereint row = m_list.getselectionmark();/让相应的空间显示相应的 学号 姓名 性别 年龄 电话 地址cstring temp;temp = m_list.getitemtext(row,1);m_strno.setwindowtext(temp);temp = m_list.getitemtext(row,2);m_strname.setwindowtext(temp);temp = m_list.getitemtext(row,3);if(temp=女)checkradiobutton(idc_student_female,idc_student_male,idc_student_female);elsecheckradiobutton(idc_student_female,idc_student_male,idc_student_male);temp = m_list.getitemtext(row,4);m_strage.selectstring(row,temp);temp = m_list.getitemtext(row,5);m_strphone.setwindowtext(temp);temp = m_list.getitemtext(row,6);m_straddress.setwindowtext(temp);*presult = 0;void cstudentdlg:onstudentadd() / todo: add your control notification handler code here/以下为设置各个按钮状态cbutton *p_femaleradio,*p_maleradio;m_strname.enablewindow(true);m_strname.setwindowtext();m_strno.enablewindow(true);m_strno.setwindowtext();m_strage.enablewindow(true);m_strage.selectstring(0,20);m_strphone.enablewindow(true);m_strphone.setwindowtext();m_straddress.enablewindow(true);m_straddress.setwindowtext();p_femaleradio =(cbutton*)this-getdlgitem(idc_student_female);p_femaleradio-enablewindow(true);p_maleradio = (cbutton*)this-getdlgitem(idc_student_male); p_maleradio-enablewindow(true);m_bok.enablewindow(true);m_badd.enablewindow(false);m_bedit.enablewindow(false);m_bdel.enablewindow(false);/设置记录集相关状态m_studentset.open();m_studentset.addnew();void cstudentdlg:onstudentedit() / todo: add your control notification handler code hereint row = m_list.getselectionmark();cstring temp,strsql;cbutton *p_femaleradio,*p_maleradio;temp = m_list.getitemtext(row,0);if(!temp.isempty()strsql.format(student_id=%s,temp);m_studentset.open();m_studentset.m_strfilter = strsql;m_studentset.requery();m_studentset.edit();/单击修改后,设置其他按钮状态m_bok.enablewindow(true);m_badd.enablewindow(false);m_bdel.enablewindow(false);m_bedit.enablewindow(false);m_strname.enablewindow(true);m_strno.enablewindow(true);m_strphone.enablewindow(true);m_straddress.enablewindow(true);m_strage.enablewindow(true);p_femaleradio =(cbutton*)this-getdlgitem(idc_student_female);p_femaleradio-enablewindow(true);p_maleradio = (cbutton*)this-getdlgitem(idc_student_male); p_maleradio-enablewindow(true);void cstudentdlg:onstudentdel() / todo: add your control notification handler code hereint row = m_list.getselectionmark();cstring temp,strsql;temp = m_list.getitemtext(row,0);if(!temp.isempty()if(messagebox(确认要删除该记录?,删除询问,mb_okcancel|mb_iconquestion)=idok)strsql.format(student_id=%s,temp);m_studentset.open();m_studentset.m_strfilter = strsql;m_studentset.requery();m_studentset.edit();m_studentset.m_student_status = n;m_studentset.update();m_studentset.close();refreshlist();void cstudentdlg:onstudentok() / todo: add your control notification handler code herecstring no,name,phone,address,strsex,temp;int age;m_strno.getwindowtext(no);m_strname.getwindowtext(name);m_strphone.getwindowtext(phone);m_straddress.getwindowtext(address);m_strage.getwindowtext(temp);age = atoi(temp);switch(getcheckedradiobutton(idc_student_female,idc_student_male)case idc_student_female : strsex = 女; break;case idc_student_male : strsex = 男; break;if(name=)messagebox(请输入学生姓名!);elsem_studentset.m_student_no = no;m_studentset.m_student_name = name;m_studentset.m_student_sex = strsex;m_studentset.m_student_age = age;m_studentset.m_student_phone = phone;m_studentset.m_student_address = address;m_studentset.m_student_status = y;m_studentset.update();m_studentset.close();refreshlist();resetbutton();void cstudentdlg:oncancel() / todo: add extra cleanup hereif(m_studentset.isopen()m_studentset.close();resetbutton();cdialog:oncancel();(3)基本信息管理(成绩管理)bool cscoredlg:oninitdialog() cdialog:oninitdialog();/ todo: add extra initialization here/初始化数据库if(!m_database.isopen()m_database.open(_t(studentscore);m_recordset.m_pdatabase = &m_database;/初始化列表框m_list.insertcolumn(0,成绩编号);m_list.insertcolumn(1,学生名);m_list.insertcolumn(2,课程名);m_list.insertcolumn(3,分数);rect listrect;m_list.getwindowrect(&listrect);int width = listrect.right-listrect.left-4;for(int i=0;i4;i+)m_list.setcolumnwidth(i,width/4);m_list.setextendedstyle(lvs_ex_fullrowselect);refreshlist();return true; / return true unless you set the focus t

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论