首页 学生档案管理系统-毕业论文

学生档案管理系统-毕业论文

举报
开通vip

学生档案管理系统-毕业论文学生档案管理系统-毕业论文 …… 学生档案管理系统是典型的信息管理系统(MIS),其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者 要求建立起数据一致性和完整性强、数据安全性好的数据库。而对于后 者则要求应用程序功能完备,易使用等特点。 经过分析,我使用 MICROSOFT公司的 VISUAL BASIC开发工具,利用其提供的各种面向对象的开发工具,尤其是数据窗口这一能方便而简洁 操纵数据库的智能化对象,首先在短时间内建立系统应用原型,然后,对初始原型系统进行需求迭代,不断修正和改进...

学生档案管理系统-毕业论文
学生档案管理系统-毕业论文 …… 学生档案管理系统是典型的信息管理系统(MIS),其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者 要求建立起数据一致性和完整性强、数据安全性好的数据库。而对于后 者则要求应用程序功能完备,易使用等特点。 经过分析,我使用 MICROSOFT公司的 VISUAL BASIC开发工具,利用其提供的各种面向对象的开发工具,尤其是数据窗口这一能方便而简洁 操纵数据库的智能化对象,首先在短时间内建立系统应用原型,然后,对初始原型系统进行需求迭代,不断修正和改进,直到形成满意的可行系 统。系统主要模块:学生信息管理、老师信息管理、系统管理等。 MIS (管理信息系统) 、控件、域。 I Summary The system of managing student file is a typical application of managing information system know as MIS,which mainly includes building up data-base of back-end and developing the application interface of front-end. The former required consistency and integrality and security of data. The later should make the application powerful and easily used. By looking up lots of datum, we selected Visual Basic presented by Microsoft because of its objective tools in Win32. VB offered a series of ActiveX operating a data-base. It can give you a short-cut to build up a prototype of system application. The prototype could be modified and developed till users are satisfied with it. Keywords:MIS, ActiveX ,Field 1.1 系统及需求分析 .................................................................................... 1 1.1.1 系统需求 ............................................... 1 1.1.2可行性分析 .................................................................................. 1 1.2系统 设计 领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计 的背景 ............................................... 5 1.3系统的功能简介 ..................................................................................... 6 1.4系统开发的目标 ..................................................................................... 6 2.1业务流程分析 ................................................. 11 2.2数据流程分析: ..................................................................................... 8 2.3数据存储分析:实体联系图 ................................................................ 9 2.4功能分析:功能层次图 ....................................................................... 10 3.1软件模块结构设计 ............................................................................... 11 II 3.2数据库设计 ......................................................................................... 11 4.1系统登陆界面: ................................................................................. 14 4.2系统主界面: ..................................................................................... 22 4.3用户管理模块: ................................................................................. 50 4.4学生缴费管理模块: ......................................................................... 63 错误!未定义 关于书的成语关于读书的排比句社区图书漂流公约怎么写关于读书的小报汉书pdf 签。 5.1系统开发环境: ........................................... 55 5.2系统测试:...................................................... 55 5.3 系统运行与维护: ........................................ 58 5.4系统的转换 方案 气瓶 现场处置方案 .pdf气瓶 现场处置方案 .doc见习基地管理方案.doc关于群访事件的化解方案建筑工地扬尘治理专项方案下载 : ....................................... 59 III 学生档案管理系统能够为用户提供充足的信息和快捷的查询手段。但 一直以来人们使用传统人工的方式管理文件档案,这种管理方式存在着许 多缺点,如:效率低、保密性差,另外时间一长,将产生大量的文件和数据,这对于查找、更新和维护都带来了不少的困难。 随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人 们深刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。 作为计算机应用的一部分,使用计算机对学生档案信息进行管理,具有着手工管理所无法比拟的优点.例如:检索迅速、查找方便、可靠性高、存 储量大、保密性好、寿命长、成本低等。这些优点能够极大地提高学生档 案管理的效率,也是企业的科学化、正规化管理,与世界接轨的重要条件。 因此,开发这样一套管理软件成为很有必要的。本系统具有较强的实用性 和先进性、规范管理、快速查询等特点。 1.1 通过调查,要求系统需要有以下功能: (1)由于操作人员的计算机知识普遍较差,要求有良好的人机界面; (2)由于该系统的使用对象多,要求有较好的权限管理; (3) 方便的数据查询,支持多条件查询; (4) 在相应的权限下,删除数据方便简单; (5) 辅助功能:如数据库的中断与连接、限定时间内没响应,自动 断开数据库连接; (6)文件预览、打印; 1 由于本系统管理的对象单一,且每个数据内容具有较强的关联性,涉 及的计算过程不是很复杂。因此,比较适合于采用数据库管理。且学校用 于学生管理的微机都是PIII以上的机器,在存储量、速度方面都能满足 数据库运行的要求。在技术难度方面,由于有指导老师的指导和相关参考 文献,特别是网上资料,特别是参考其它程序的功能,因此完全可以实现。 本系统的设计是在Windows XP简体中文版操作系统环境下,使用MS Visual Basic 6.0中文版开发成功的。数据库是MIS中的重要支持技术,在MIS开发过程中,如何选择数据库管理是一个重要的问题,目前,数 据库产品较多,每种产品都具有各自的特点和适用范围,因此,在选择数 据库时,应考虑数据库应用的特点及适用范围,本系统选用的数据库语言 介绍如下: Visual Basic语言 Visual Basic是一种可视化的、面对对象和条用事件驱动方式的结构 化高级程序设计,可用于开发Windows环境下的种类应用程序。它简单 易学、效率高,且功能强大,可以与Windows的专业开发工具SDK相媲美,而且程序开发人员不必具有C/C++编程基础。在Visual Basic环境下,利用事件驱动的编程机制、新颖易用的可视化设计工具,使用Windows内部的应用程序接口(API)函数,以及动态链接库(DLL)、动态数据交换(DDE)、对象的链接与嵌入(OLE)、开放式数据访问(ODBC)等技术,可以高效、快速地开发出Windows环境下功能强大、图形界面丰富的应用软 件系统。 总的来说,Visual Basic具有以下特点: 2 可视化编程: 用传统程序设计语言设计程序时,都是通过编写程序代码来设计用户 界面,在设计过程中看不到界面的实际显示效果,必须编译后运行程序才 能观察。如果对界面的效果不满意,还要回到程序中修改。有时候,这种 编程-编译-修改的操作可能要反复多次,大大影响了软件开发效率。Visual Basic提供了可视化设计工具,把Windows界面设计的复杂性“封装”起来,开发人员不必为界面设计而编写大量程序代码。只需要按设计要求的 屏幕布局,用系统提供的工具,在屏幕上画出各种“部件”,即图形对象, 并设置这些图形对象的属性。Visual Basic自动产生界面设计代码,程序设计人员只需要编写实现程序功能的那部分代码,从而可以大大提高程序 设计的效率。 面向对象的程序设计 4.0版以后的Visual Basic支持面向对象的程序设计,但它与一般的面 向对象的程序设计语言(C++)不完全相同。在一般的面向对象程序设计语 言中,对象由程序代码和数据组成,是抽象的概念;而Visual Basic则是 应用面向对象的程序设计方法(OOP),把程序和数据封装起来作为一个对象,并为每个对象赋予应有的属性,使对象成为实在的东西。在设计对象 时,不必编写建立和描述每个对象的程序代码,而是用工具画在界面上, Visual Basic自动生成对象的程序代码并封装起来。每个对象以图形方式 显示在界面上,都是可视的。 结构化程序设计语言 Visual Basic是在BASIC语言的基础上发展起来的,具有高级程序设 计语言的语句结构,接近于自然语言和人类的逻辑思维方式。Visual Basic 语句简单易懂,其编辑器支持彩色代码,可自动进行语法错误检查,同时 具有功能强大且使用灵活的调试器和编译器。 3 Visual Basic是解释型语言,在输入代码的同时,解释系统将高级语言 分解翻译成计算机可以识别的机器指令,并判断每个语句的语法错误。在 设计Visual Basic程序的过程中,随时可以运行程序,而在整个程序设计 好之后,可以编译生成可执行文件(.EXE),脱离Visual Basic环境,直接 在Windows环境下运行。 事件驱动编程机制 Visual Basic通过事件来执行对象的操作。一个对象可能会产生多个事 件,每个事件都可以通过一段程序来响应。例如,命令按钮是一个对象, 当用户单击该按钮时,将产生一个“单击“(CLICK)事件,而在产生该事件时将执行一段程序,用来实现指定的操作。 在用Visual Basic设计大型应用软件时,不必建立具有明显开始和结 束的程序,而是编写若干个微小的子程序,即过程。这些过程分别面向不 同的对象,由用户操作引发某个事件来驱动完成某种特定的功能,或者由 事件驱动程序调用通用过程来执行指定的操作,这样可以方便编程人员, 提高效率。 访问数据库 Visual Basic具有强大的数据库管理功能,利用数据控件和数据库管理 窗口,可以直接建立或处理Microsoft Access格式的数据库,并提供了强大的数据存储和检索功能。同时,Visual Basic还能直接编辑和访问其他外部数据库,如dBASE,FoxPro,Paradox等,这些数据库格式都可以用Visual Basic编辑和处理。 Visual Basic提供开放式数据连接,即ODBC功能,可通过直接访问或建立连接的方式使用并操作后台大型网络数据库,如SQL Server,Oracle 等。在应用程序中,可以使用结构化查询语言SQL数据 标准 excel标准偏差excel标准偏差函数exl标准差函数国标检验抽样标准表免费下载红头文件格式标准下载 ,直接访问服务器上的数据库,并提供了简单的面向对象的库操作指令和多用户数据 4 库访问的加锁机制和网络数据库的SQL的编程技术,为单机上运行的数 据库提供了SQL网络接口,以便在分布式环境中快速而有效地实现客户/服务器(client/server)方案。 动态数据交换(DDE) 利用动态数据交换(Dynamic Data Exchange)技术,可以把一种应用程 序中的数据动态地链接到另一种应用程序中,使两种完全不同的应用程序 建立起一条动态数据链路。当原始数据变化时,可以自动更新链接的数据。 Visual Basic提供了动态数据交换的编程技术,可以在应用程序中与其他 Windows应用程序建立动态数据交换,在不同的应用程序之间进行通信。 对象的链接与嵌入(OLE) 对象的链接与嵌入(OLE)将每个应用程序都看做是一个对象(object),将不同的对象链接(link)起来,再嵌入(embed)某个应用程序中,从而可以 得到具有声音、影像、图像、动画、文字等各种信息的集合式的文件。 OLE技术是Microsoft公司对象技术的战略,它把多个应用程序合为一体, 将每个应用程序看做是一个对象进行链接和嵌入,是一种应用程序一体化 的技术。利用OLE技术,可以方便地建立复合式文档(compound document),这种文档由来自多个不同应用程序的对象组成,文档中的每 个对象都与原来的应用程序相联系,并可执行与原来应用程序完全相同的 操作。 动态链接库(DLL) Visual Basic是一种高级程序设计语言,不具备低级语言的功能,对 访问机器硬件的操作不太容易实现。但它可以通过动态链接库技术将 C/C++或汇编语言编写的程序加入到Visual Basic应用程序中,可以像调用内部函数一样调用其他语言编写的函数。此外,通过动态链接库,还可 以调用Windows应用程序接口(API)函数,实现SDK所具有的功能。 5 本系统主要功能:学生信息管理、老师信息管理、系统管理等等。 1.3.1 项目规划 学生档案管理系统是一个典型的数据库应用程序,由学生档案管理、老师信息管理、系统管理等模块组成。特规划如下: 1.3.2系统管理模块(CTRL+O) 该模块的主要任务是维护系统的正常运行和安全性设置,包括添加用户(快捷键:CTRL+A)、修改密码(快捷键:CTRL+B)、重新登录(快捷键:CTRL+F1)、数据库的连接与断开、文件浏览及打印等等。 1.3.3学生信息管理模块(CTRL+P): 该模块的功能是实现对学生信息管理工作,包括:学生添加、学生修 改、学生查询等,完成对学生档案信息的规范管理、快速的查询。 1.3.4老师信息管理模块(CTRL+T): 该模块的主要功能是实现对老师个人信息的管理工作,包括档案添 加、档案修改、档案查询等功能,从而方便对老师信息基本情况的规范管 理、快速的查询。 出于本系统是学生档案管理的一个综合性的系统,本系统的设计目标将最终定位于 完成以上所述的系统主要业务的基本模型上,其管理界面友好化,增强人机交互性, 6 同时也提高数据的可靠性。 7 2.1.1 从学生角度分析 2.1.2 从老师角度分析 2.1.3 从管理员角度分析 2.1.4 技术可行性说明 2.2: 下面仅以学生信息管理模块为例来进行编制: 管 理 员 学 生 管理员 学生档案 查询 档 老 师 学生 案 老师 管 理 系 学生 统 8 1、数据模型设计。首先来做出学生信息管理系统的E-R图,分析这个问题的实体,从系统分析可以知道,学生的档案管理系统是由学生、老 师、管理员组成了这个系统的三个实体。 2、再分析三个实体之间的联系。首先,这三个实体不是一个统一体, 学生档案与老师档案没有内在联系。 9 2.4 学生档案信息管理系统 登 陆 学老系 生师统 信信管 息息理 管管 理 理 信信信信信信信信密信窗数息息息息息息息息码息口据录修查删录修查删修打排库入 改 询 除 入 改 询 除 改 印 列 连 接 10 3.1.1系统方案确定 通过对系统的调研与分析,系统主要应完成的功能有:学生信息管 理、老师信息管理、系统管理等功能。 3.1.2软件结构设计 本系统在执行时,先根据不同的操作人员的需要来进行相应的模 块,然后可进行数据输入、修改、查询、浏览、打印等操作。 数据库采用MS SQL Server 2000数据库,由于SQL Server具有高度的数据安全性,及强大的功能、快速的查询速率、方便管理。 3.2.1本系统中所涉及到的主要实体共有三个数据表: 学生信息管理表xt_student:{学号 姓名 性别 院 系 专业 年级 班级 照片 籍贯 政治面貌 父母姓名 手机 家庭电话 单位电话 获得奖励 惩罚情况 学籍变动情况} 老师信息管理表xt_teacher:{编号 姓名 性别 年龄 籍贯 联系电话 联系地址 院系 职务 职称 备注} 用户登陆信息表xt_user:{序号 用户帐号 用户密码 用户类型} 11 3.2.2 xt_student表: 字段名称 类型 宽度 是否可为空 学号 否(主键) Varchar 50 姓名 是 Varchar 50 性别 是 Varchar 50 院 是 Varchar 50 系 是 Varchar 50 专业 是 Varchar 50 年级 是 Varchar 50 班级 是 Varchar 50 照片 是 Varchar 200 籍贯 是 Varchar 50 政治面貌 是 Varchar 50 父母姓名 是 Varchar 50 手机 是 Varchar 50 家庭电话 是 Varchar 50 单位电话 是 Varchar 50 家庭住址 是 Varchar 200 获得奖励 是 Varchar 200 惩罚情况 是 Varchar 200 学籍变动情况 是 Varchar 50 Xt_teacher表: 12 字段名称 类型 宽度 是否可为空 编号 否(主键) Varchar 50 姓名 是 Varchar 50 性别 是 Varchar 50 年龄 是 Varchar 50 籍贯 是 Varchar 50 联系电话 是 Varchar 50 联系地址 是 Varchar 200 院系 是 Varchar 50 职务 是 Varchar 50 职称 是 Varchar 200 备注 是 Varchar 200 Xt_user表: 字段名称 类型 宽度 是否可为空 序号 Int自动增加 否(主键) 10 用户帐号 否 Varchar 50 用户密码 是 Varchar 50 用户类型 是 Varchar 50 13 第四章系统的功能 本部分主要内容为本系统的运行界面以及主要界面的源代码。 本界面的主要功能是为了对系统进行安全性管理,本系统的用户名和 密码保存在xt_user表中,本系统根据不同的用户而设置了不同的权限, 可以用admin、system、管理员为用户帐户、用户密码、用户类型来登陆 本系统(默认)。 说明:(1)用户类型包括学生、老师、管理员,即可以选择不同的权限。 (2)用户帐户、用户密码连续5次输入错误,暂时无法登录系统。 Dim ll_time As Integer, ll_yhzh, ll_old_yhzh As String Private Sub cmd_exit_Click() Unload Me End Sub Private Sub cmd_login_Click() 14 If Trim(txt_yhzh.Text) = "" Then MsgBox "用户帐户不能为空!", vbOKOnly, "提示" txt_yhzh.SetFocus Exit Sub End If If Trim(cmb_yhlx.Text) = "" Then MsgBox "请选择用户类型!", vbOKOnly, "提示" cmb_yhlx.SetFocus Exit Sub End If '步骤2同一用户名5次错误,系统提示 你暂时无法登陆 If ll_old_yhzh = ll_yhzh Then If ll_time = 5 Then MsgBox "你暂时无法登陆,请与管理员联系!", vbDefaultButton1, "提示" Exit Sub End If Else ll_time = 0 End If Str_sql = "select * from xt_user where dbo.StrComp(yhmm, '" & txt_yhmm & "')=1 and yhmm= '" & txt_yhmm & "' and yhzh= '" & txt_yhzh & "' and yhlx= '" & cmb_yhlx & "'" 15 Set mrc = ExecuteSQL(Str_sql) If mrc.RecordCount > 0 Then Ps_yhlx = cmb_yhlx If Ps_yhlx = "学生" Then Ps_xh = txt_yhzh '判断修改是否已经填写过信息 Str_sql = "select jg from xt_student where xh= '" & Ps_xh & "'" Set mrc = ExecuteSQL(Str_sql) If mrc.Fields("jg") = "" Then Pi_operation = 1 Else Pi_operation = 2 End If frm_student.Show Unload Me Else frm_main.Show Unload Me End If Else '步骤3同一用户名5次错误,系统提示 你暂时无法登陆 If ll_time = 0 Then ll_yhzh = txt_yhzh End If 16 If ll_old_yhzh = ll_yhzh Then ll_time = ll_time + 1 Else ll_time = 0 End If MsgBox "登陆失败,请注意大小写,输入正确的用户名或密码", vbDefaultButton1, "提示" End If End Sub Private Sub cmd_modify_Click() frm_modify.Show End Sub Private Sub Form_Activate() Ps_window = "frm_login" End Sub Private Sub Form_Load() opertion = Year(Date) If Month(Date) < 10 Then opertion = opertion & 0 & Month(Date) 17 Else opertion = opertion & Month(Date) End If If Day(Date) < 10 Then opertion = opertion & 0 & Day(Date) Else opertion = opertion & Day(Date) End If nf_login.LoadSkin nf_login.MnuStyleIdx '载入界面样式,为了使界面和菜单对应,所以使用NiceForm的MnuStyleIdx为参数 nf_login.AutoSkinControl '让控件自动设计窗体上的其它Nice控件的界面样式 End Sub Private Sub txt_yhzh_Change() '步骤1同一用户名5次错误,系统提示 你暂时无法登陆 ll_old_yhzh = txt_yhzh End Sub 修改用户密码: 18 及源代码: Private Sub cmd_cancle_Click() Unload Me End Sub Private Sub cmd_sure_Click() If Pb_time = True Then If MsgBox(" 由于你3分钟用户对电脑未作任何操作,系统自动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出 系统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms 19 Unload Form Next Form frm_login.Show End If Exit Sub End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, "提示" Exit Sub End If If Trim(txt_yhzh.Text) = "" Then MsgBox "用户帐户不能为空!", vbOKOnly, "提示" txt_yhzh.SetFocus Exit Sub End If If Trim(cmb_yhlx.Text) = "" Then MsgBox "请选择所在类型!", vbOKOnly, "提示" cmb_yhlx.SetFocus Exit Sub End If 20 If Trim(txt_new_mm.Text) <> Trim(txt_sure_mm.Text) Then MsgBox "新密码与确认密码不一致,请重新输入!", vbOKOnly, "提示" txt_new_mm.SetFocus Exit Sub End If Str_sql = "select * from xt_user where dbo.StrComp(yhmm, '" & txt_yhmm & "')=1 and yhmm= '" & txt_yhmm & "' and yhzh= '" & txt_yhzh & "' and yhlx= '" & cmb_yhlx & "'" Set mrc = ExecuteSQL(Str_sql) If mrc.RecordCount > 0 Then Str_sql = "update xt_user set yhmm='" & txt_new_mm & "' where dbo.StrComp(yhmm, '" & txt_yhmm & "')=1 and yhmm= '" & txt_yhmm & "' and yhzh= '" & txt_yhzh & "' and yhlx= '" & cmb_yhlx & "'" Set mrc = ExecuteSQL(Str_sql) MsgBox "修改成功!", vbDefaultButton1, "提示" Else MsgBox "登陆失败,请注意大小写,输入正确的用户名或密码", vbDefaultButton1, "提示" End If End Sub 21 Private Sub Form_Activate() Ps_window = "frm_modify" End Sub Private Sub Form_Load() nf_modify.LoadSkin nf_modify.MnuStyleIdx '载入界面样式, 为了使界面和菜单对应,所以使用NiceForm的MnuStyleIdx为参数 nf_modify.AutoSkinControl '让控件自动设计窗体上的其它Nice控件的界面样式 End Sub 本模块是本系统的应用界面,在本界面上集成了本系统的所有功能, 共有3个功能菜单和11个子菜单(功能模块),从而实现了本系统对学生 档案信息管理系统的具体功能,同时,在系统管理模块中可以完成对本系 统的安全性管理。主界面如下: 22 实现代码: Public Sub cmb_lx_Click() b = init_window(cmb_lx) b = init_xllb(cmb_lx.Text) If cmb_lx = "学生" Then Str_sql = "select * from xt_student order by xh" ElseIf cmb_lx = "老师" Then Str_sql = "select * from xt_teacher order by bh" End If Set mrc = ExecuteSQL(Str_sql) 23 b = show_data(cmb_lx.Text) End Sub Private Sub cmb_lx_DropDown() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自 动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" 24 'cmd_exit.SetFocus Exit Sub End If End Sub Private Sub cmd_delete_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自 动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub End If 25 If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, "提示" Exit Sub End If '删除操作 If Me.grd_data.Rows <= 2 Then MsgBox "当前 记录 混凝土 养护记录下载土方回填监理旁站记录免费下载集备记录下载集备记录下载集备记录下载 为空,不允许删除!", vbOKOnly + vbExclamation, "提示" Exit Sub Else If Trim(Me.grd_data.TextMatrix(grd_data.Row, 1)) = "" Then MsgBox "请选中你需要进行操作的行!", vbOKOnly + vbExclamation, "提示" Exit Sub Else If MsgBox("确定要删除此记录吗?", vbOKCancel + vbExclamation, "警告") = 1 Then If cmb_lx = "学生" Then Ps_xh = Me.grd_data.TextMatrix(grd_data.Row, 1) Str_sql = "select * from xt_student where xh='" & Ps_xh & "'" 26 ElseIf cmb_lx = "老师" Then Ps_bh = Me.grd_data.TextMatrix(grd_data.Row, 1) Str_sql = "select * from xt_teacher where bh='" & Ps_bh & "'" End If Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = False Then mrc.Delete End If Me.grd_data.RemoveItem (grd_data.Row) End If End If End If End Sub Private Sub cmd_exit_Click() Unload Me End Sub 27 Private Sub cmd_modify_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自 动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" Exit Sub End If If Me.grd_data.Rows < 2 Then 28 MsgBox "当前记录为空,不允许修改!", vbOKOnly + vbExclamation, "提示" Exit Sub Else If Trim(Me.grd_data.TextMatrix(grd_data.Row, 1)) = "" Then MsgBox "请选中你需要进行操作的行!", vbOKOnly + vbExclamation, "提示" Exit Sub Else '修改标志 Pi_operation = 1 If cmb_lx = "学生" Then Ps_xh = Me.grd_data.TextMatrix(grd_data.Row, 1) frm_student.Show ElseIf cmb_lx = "老师" Then Ps_bh = Me.grd_data.TextMatrix(grd_data.Row, 1) frm_teacher.Show End If End If End If End Sub Private Sub cmd_newadd_Click() 29 If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" Exit Sub End If If cmb_lx = "学生" Then Pi_operation = 0 30 frm_student.Show ElseIf cmb_lx = "老师" Then Pi_operation = 0 frm_teacher.Show End If End Sub Public Sub cmd_search_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自 动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub End If 31 If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" Exit Sub End If Dim ll_row As Long, ls_sql As String ls_sql = "1=1" '学生所搜:条件连接 If cmb_lx.Text = "学生" Then If cmb_xs_xy <> "" Then ls_sql = ls_sql & " and yuan= '" & cmb_xs_xy & "'" End If If cmb_xs_zy <> "" Then ls_sql = ls_sql & " and zy= '" & cmb_xs_zy & "'" End If If cmb_xs_nj <> "" Then ls_sql = ls_sql & " and nj= '" & cmb_xs_nj & "'" End If If cmb_xs_xm <> "" Then ls_sql = ls_sql & " and xm= '" & cmb_xs_xm & "'" 32 End If Str_sql = "select * from xt_student where " & ls_sql & " order by xh " '老师所搜:条件连接 ElseIf cmb_lx.Text = "老师" Then If cmb_ls_yx <> "" Then ls_sql = ls_sql & " and yx= '" & cmb_ls_yx & "'" End If If cmb_ls_zw <> "" Then ls_sql = ls_sql & " and zw= '" & cmb_ls_zw & "'" End If If cmb_ls_zc <> "" Then ls_sql = ls_sql & " and zc= '" & cmb_ls_zc & "'" End If If cmb_ls_xm <> "" Then ls_sql = ls_sql & " and xm= '" & cmb_ls_xm & "'" End If Str_sql = "select * from xt_teacher where " & ls_sql & " order by bh " 33 End If Set mrc = ExecuteSQL(Str_sql) b = show_data(cmb_lx.Text) End Sub Private Sub cmd_view_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自 动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub 34 End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" Exit Sub End If If Me.grd_data.Rows < 2 Then MsgBox "当前记录为空,不允许修改!", vbOKOnly + vbExclamation, "提示" Exit Sub Else If Trim(Me.grd_data.TextMatrix(grd_data.Row, 1)) = "" Then MsgBox "请选中你需要进行操作的行!", vbOKOnly + vbExclamation, "提示" Exit Sub Else '查看标志 Pi_operation = 2 If cmb_lx = "学生" Then Ps_xh = Me.grd_data.TextMatrix(grd_data.Row, 1) frm_student.Show 35 ElseIf cmb_lx = "老师" Then Ps_bh = Me.grd_data.TextMatrix(grd_data.Row, 1) frm_teacher.Show End If End If End If End Sub Private Sub Form_Activate() Ps_window = "frm_main" End Sub Private Sub Form_Load() Me.Width = 15300 Me.Height = 10395 Me.Left = (mdi_main.Width - Me.Width) / 2 Me.Top = 0 nf_main.LoadSkin nf_main.MnuStyleIdx '载入界面样式,为了使界 面和菜单对应,所以使用NiceForm的MnuStyleIdx为参数 36 nf_main.AutoSkinControl '让控件自动设计窗体上的其它Nice控件 的界面样式 cmb_lx.ListIndex = 0 b = init_window("学生") b = init_xllb("学生") Str_sql = "select * from xt_student order by xh" Set mrc = ExecuteSQL(Str_sql) b = show_data("学生") End Sub Private Sub grd_data_DblClick() Call cmd_view_Click End Sub Function init_xllb(ls_lx As String) If ls_lx = "学生" Then '学院初始化 Str_sql = "select distinct yuan from xt_student where yuan<>''" Set mrc = ExecuteSQL(Str_sql) 37 If mrc.EOF = True Then '不操作 Else cmb_xs_xy.Clear cmb_xs_xy.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_xs_xy.AddItem mrc.Fields("yuan") mrc.MoveNext Loop Set mrc = Nothing End If '专业初始化 Str_sql = "select distinct zy from xt_student where zy<>''" Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = True Then '不操作 Else cmb_xs_zy.Clear cmb_xs_zy.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_xs_zy.AddItem mrc.Fields("zy") mrc.MoveNext 38 Loop Set mrc = Nothing End If '年级初始化 Str_sql = "select distinct nj from xt_student where nj<>''" Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = True Then '不操作 Else cmb_xs_nj.Clear cmb_xs_nj.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_xs_nj.AddItem mrc.Fields("nj") mrc.MoveNext Loop Set mrc = Nothing End If '姓名初始化 Str_sql = "select distinct xm from xt_student where xm<>''" Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = True Then '不操作 39 Else cmb_xs_xm.Clear cmb_xs_xm.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_xs_xm.AddItem mrc.Fields("xm") mrc.MoveNext Loop Set mrc = Nothing End If ElseIf ls_lx = "老师" Then '院系初始化 Str_sql = "select distinct yx from xt_teacher where yx<>''" Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = True Then '不操作 Else cmb_ls_yx.Clear cmb_ls_yx.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_ls_yx.AddItem mrc.Fields("yx") mrc.MoveNext Loop 40 Set mrc = Nothing End If '职务初始化 Str_sql = "select distinct zw from xt_teacher where zw<>''" Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = True Then '不操作 Else cmb_ls_zw.Clear cmb_ls_zw.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_ls_zw.AddItem mrc.Fields("zw") mrc.MoveNext Loop Set mrc = Nothing End If '职称初始化 Str_sql = "select distinct zc from xt_teacher where zc<>''" Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = True Then '不操作 Else 41 cmb_ls_zc.Clear cmb_ls_zc.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_ls_zc.AddItem mrc.Fields("zc") mrc.MoveNext Loop Set mrc = Nothing End If '姓名初始化 Str_sql = "select distinct xm from xt_teacher where xm<>''" Set mrc = ExecuteSQL(Str_sql) If mrc.EOF = True Then '不操作 Else cmb_ls_xm.Clear cmb_ls_xm.AddItem "" mrc.MoveFirst Do Until mrc.EOF cmb_ls_xm.AddItem mrc.Fields("xm") mrc.MoveNext Loop Set mrc = Nothing End If 42 End If End Function Function init_window(ls_lx As String) '初始化学生信息界面 If ls_lx = "学生" Then cmb_xs_xy.Visible = True cmb_xs_zy.Visible = True cmb_xs_nj.Visible = True cmb_xs_xm.Visible = True lab_xs_xy.Visible = True lab_xs_zy.Visible = True lab_xs_nj.Visible = True lab_xs_xm.Visible = True cmb_ls_yx.Visible = False cmb_ls_zw.Visible = False cmb_ls_zc.Visible = False cmb_ls_xm.Visible = False lab_ls_yx.Visible = False lab_ls_zw.Visible = False lab_ls_zc.Visible = False 43 lab_ls_xm.Visible = False nc_main.Caption = "学生信息" With grd_data .Rows = 1 .Cols = 9 .TextMatrix(0, 0) = "序号" .TextMatrix(0, 1) = "学号" .TextMatrix(0, 2) = "姓名" .TextMatrix(0, 3) = "性别" .TextMatrix(0, 4) = "学院" .TextMatrix(0, 5) = "系" .TextMatrix(0, 6) = "年级" .TextMatrix(0, 7) = "班级" .TextMatrix(0, 8) = "专业" .ColWidth(0) = 800 .ColWidth(1) = 1000 .ColWidth(2) = 1000 .ColWidth(3) = 1000 .ColWidth(4) = 2000 .ColWidth(5) = 2000 .ColWidth(6) = 2000 .ColWidth(7) = 2000 .ColWidth(8) = 3000 .Rows = 2 End With 44 '初始化老师信息界面 ElseIf ls_lx = "老师" Then cmb_xs_xy.Visible = False cmb_xs_zy.Visible = False cmb_xs_nj.Visible = False cmb_xs_xm.Visible = False lab_xs_xy.Visible = False lab_xs_zy.Visible = False lab_xs_nj.Visible = False lab_xs_xm.Visible = False cmb_ls_yx.Visible = True cmb_ls_zw.Visible = True cmb_ls_zc.Visible = True cmb_ls_xm.Visible = True lab_ls_yx.Visible = True lab_ls_zw.Visible = True lab_ls_zc.Visible = True lab_ls_xm.Visible = True nc_main.Caption = "老师信息" With grd_data .Rows = 1 45 .Cols = 8 .TextMatrix(0, 0) = "序号" .TextMatrix(0, 1) = "老师编号" .TextMatrix(0, 2) = "姓名" .TextMatrix(0, 3) = "年龄" .TextMatrix(0, 4) = "性别" .TextMatrix(0, 5) = "院系" .TextMatrix(0, 6) = "职称" .TextMatrix(0, 7) = "职务" .ColWidth(0) = 800 .ColWidth(1) = 1000 .ColWidth(2) = 1000 .ColWidth(3) = 1000 .ColWidth(4) = 1000 .ColWidth(5) = 3000 .ColWidth(6) = 3000 .ColWidth(7) = 4000 .Rows = 2 End With End If End Function Function show_data(ls_lx As String) Dim ll_row As Long '显示学生数据 46 If ls_lx = "学生" Then If mrc.EOF = True Then '清空数据 grd_data.Rows = 1 '加一行空行 grd_data.Rows = 2 'MsgBox "你所查询的信息不存在!", vbDefaultButton1, " 提示" Else ll_row = mrc.RecordCount If ll_row >= 1 Then '清空数据 grd_data.Rows = 1 '加一行空行 grd_data.Rows = 2 For i = 1 To ll_row With grd_data If mrc.EOF = False Then .Rows = .Rows + 1 .TextMatrix(i, 0) = i '序号 .TextMatrix(i, 1) = mrc.Fields("xh") .TextMatrix(i, 2) = mrc.Fields("xm") .TextMatrix(i, 3) = mrc.Fields("xb") 47 .TextMatrix(i, 4) = mrc.Fields("yuan") .TextMatrix(i, 5) = mrc.Fields("xi") .TextMatrix(i, 6) = mrc.Fields("nj") .TextMatrix(i, 7) = mrc.Fields("bj") .TextMatrix(i, 8) = mrc.Fields("zy") End With mrc.MoveNext Next Else MsgBox "记录为空,请先录入!", vbDefaultButton1, "提示" grd_data.Rows = 1 End If End If '显示老师数据 ElseIf ls_lx = "老师" Then If mrc.EOF = True Then '清空数据 grd_data.Rows = 1 '加一行空行 grd_data.Rows = 2 'MsgBox "你所查询的信息不存在!", vbDefaultButton1, " 提示" 48 Else ll_row = mrc.RecordCount If ll_row >= 1 Then '清空数据 grd_data.Rows = 1 '加一行空行 grd_data.Rows = 2 For i = 1 To ll_row With grd_data If mrc.EOF = False Then .Rows = .Rows + 1 .TextMatrix(i, 0) = i '序号 .TextMatrix(i, 1) = mrc.Fields("bh") .TextMatrix(i, 2) = mrc.Fields("xm") .TextMatrix(i, 3) = mrc.Fields("xb") .TextMatrix(i, 4) = mrc.Fields("nl") .TextMatrix(i, 5) = mrc.Fields("yx") .TextMatrix(i, 6) = mrc.Fields("zc") .TextMatrix(i, 7) = mrc.Fields("zw") End With mrc.MoveNext Next Else MsgBox "记录为空,请先录入!", vbDefaultButton1, "提示" 49 End If End If End If End Function 'MsgBox Me.Left & "," & Me.Top & "," & Me.Width & "," & Me.Height 本窗口实现管理员通过学生编号产生的规则对学生学号进行批量的 初始化,界面如下: 实现代码: 50 Private Sub cmd_exit_Click() Unload Me End Sub Private Sub cmd_sure_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自 动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" 51 Exit Sub End If If Trim(txt_nf.Text) = "" Then MsgBox "年份不能为空!", vbOKOnly, "提示" txt_nf.SetFocus Exit Sub End If If Trim(txt_jj.Text) = "" Then MsgBox "季节不能为空!", vbOKOnly, "提示" txt_jj.SetFocus Exit Sub End If If Trim(txt_xy.Text) = "" Then MsgBox "学院不能为空!", vbOKOnly, "提示" txt_xy.SetFocus Exit Sub End If If Trim(txt_xi.Text) = "" Then MsgBox "系不能为空!", vbOKOnly, "提示" txt_xi.SetFocus Exit Sub 52 End If If Trim(txt_bj.Text) = "" Then MsgBox "班级不能为空!", vbOKOnly, "提示" txt_bj.SetFocus Exit Sub End If If Trim(txt_qssz.Text) = "" Then MsgBox "起始数字不能为空!", vbOKOnly, "提示" txt_qssz.SetFocus Exit Sub End If If Trim(txt_csgs.Text) = "" Then MsgBox "产生个数不能为空!", vbOKOnly, "提示" txt_csgs.SetFocus Exit Sub End If Dim i, ll_min, ll_max As Long, ls_sql As String ll_min = txt_qssz ll_max = CLng(txt_qssz) + CLng(txt_csgs) - 1 For i = ll_min To ll_max If i < 10 Then i = "0" & i 53 ls_sql = txt_nf & txt_jj & txt_xy & txt_xi & txt_bj & i Str_sql = "select xh from xt_student where xh= '" & ls_sql & "'" Set mrc = ExecuteSQL(Str_sql) If mrc.RecordCount < 1 Then Str_sql = "insert into xt_student values('" & ls_sql & "','','','','','','','','','','','','','','','','','','')" Set mrc = ExecuteSQL(Str_sql) Str_sql = "insert into xt_user values('" & ls_sql & "','" & ls_sql & "','学生')" Set mrc = ExecuteSQL(Str_sql) End If Next i MsgBox "学号生成成功", vbDefaultButton1, "提示" End Sub Private Sub Form_Activate() Ps_window = "frm_init" End Sub Private Sub Form_Load() 54 nf_init.LoadSkin nf_init.MnuStyleIdx '载入界面样式,为了使界 面和菜单对应,所以使用NiceForm的MnuStyleIdx为参数 nf_init.AutoSkinControl '让控件自动设计窗体上的其它Nice控件 的界面样式 End Sub Private Sub txt_nf_KeyPress(KeyAscii As Integer) If KeyAscii >= 33 Then If KeyAscii <= vbKey9 And KeyAscii >= vbKey0 Then Else '把KeyAscii设为0就是取消输入。 KeyAscii = 0 'MsgBox "不要输入数字!" End If End If End Sub Private Sub txt_jj_KeyPress(KeyAscii As Integer) If KeyAscii >= 33 Then If KeyAscii <= vbKey9 And KeyAscii >= vbKey0 Then Else '把KeyAscii设为0就是取消输入。 KeyAscii = 0 'MsgBox "不要输入数字!" End If End If End Sub 55 Private Sub txt_xy_KeyPress(KeyAscii As Integer) If KeyAscii >= 33 Then If KeyAscii <= vbKey9 And KeyAscii >= vbKey0 Then Else '把KeyAscii设为0就是取消输入。 KeyAscii = 0 'MsgBox "不要输入数字!" End If End If End Sub Private Sub txt_xi_KeyPress(KeyAscii As Integer) If KeyAscii >= 33 Then If KeyAscii <= vbKey9 And KeyAscii >= vbKey0 Then Else '把KeyAscii设为0就是取消输入。 KeyAscii = 0 'MsgBox "不要输入数字!" End If End If End Sub Private Sub txt_bj_KeyPress(KeyAscii As Integer) If KeyAscii >= 33 Then If KeyAscii <= vbKey9 And KeyAscii >= vbKey0 Then Else '把KeyAscii设为0就是取消输入。 56 KeyAscii = 0 'MsgBox "不要输入数字!" End If End If End Sub Private Sub txt_qssz_KeyPress(KeyAscii As Integer) If KeyAscii >= 33 Then If KeyAscii <= vbKey9 And KeyAscii >= vbKey0 Then Else '把KeyAscii设为0就是取消输入。 KeyAscii = 0 'MsgBox "不要输入数字!" End If End If End Sub Private Sub txt_csgs_KeyPress(KeyAscii As Integer) If KeyAscii >= 33 Then If KeyAscii <= vbKey9 And KeyAscii >= vbKey0 Then Else '把KeyAscii设为0就是取消输入。 KeyAscii = 0 'MsgBox "不要输入数字!" End If End If End Sub 57 Private Sub Command1_Click() If Trim(Text1(0).Text) = "" Then MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告" Text1(0).SetFocus Exit Sub End If If Trim(Text1(1).Text) = "" Then MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告" Text1(1).SetFocus Exit Sub End If 58 If Trim(Text1(2).Text) = "" Then MsgBox "确认密码不能为空!", vbExclamation + vbOKOnly, "警告" Text1(2).SetFocus Exit Sub End If If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then MsgBox "确认密码不正确!", vbExclamation + vbOKOnly, "警告" Text1(2).SetFocus Exit Sub End If Dim aa As Integer aa = 0 If Option1(2).Value = True Then For i = 0 To 3 If Check1(i).Value = 1 Then aa = 1 Exit For End If Next i If aa = 0 Then MsgBox " 普通用户至少要有一项权限!", vbExclamation + vbOKOnly, "警告" Exit Sub End If End If 59 Dim mrc As ADODB.Recordset txtsql = "select * from use where username='" & Trim(Text1(0).Text) & "'" Set mrc = ExecuteSQL(txtsql) If mrc.EOF = False Then MsgBox " 已存在该用户!", vbExclamation + vbOKOnly, "警告" Text1(0).SetFocus Text1(0).SelStart = 0 Text1(0).SelLength = Len(Text1(0).Text) Exit Sub End If txtsql = "select * from use" Set mrc = ExecuteSQL(txtsql) mrc.AddNew mrc.Fields(0) = Trim(Text1(0).Text) mrc.Fields(1) = Trim(Text1(1).Text) For i = 0 To 2 If Option1(i).Value = True Then Select Case i Case 0 mrc.Fields("admin") = "y" Case 1 mrc.Fields("readonly") = "y" Case 2 60 For j = 0 To 3 If Check1(j).Value = 1 Then Select Case j Case 0 mrc.Fields("qx1") = "y" Case 1 mrc.Fields("qx2") = "y" Case 2 mrc.Fields("qx3") = "y" Case 3 mrc.Fields("qx4") = "y" End Select End If Next j End Select End If Next i mrc.Update MsgBox " 用户添加成功!", vbExclamation + vbOKOnly, "警告" Text1(0).Text = "" Text1(1).Text = "" Text1(2).Text = "" 61 End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Option1(2).Value = True End Sub Private Sub Form_Resize() Text1(0).SetFocus End Sub Private Sub Option1_Click(Index As Integer) If Index <> 2 Then For i = 0 To 3 Check1(i).Enabled = False Next i Else For i = 0 To 3 Check1(i).Enabled = True Next i End If 62 End Sub 4.4 本窗口实现对不同对象对学生信息的录入,修改,查看.界面如下: 代码如下: '存放上传照片名称,无路径的 Dim ls_tpmc As String 63 Private Sub cmb_exit_Click() If Pi_operation = 0 Or Pi_operation = 1 And Ps_yhlx <> " 学生" Then b = frm_main.init_xllb(frm_main.cmb_lx) Call frm_main.cmd_search_Click End If Unload Me End Sub Private Sub cmd_open_Click() '错误跳转 On Error GoTo ErrorHandle dlg_file.CancelError = True '文件过滤 dlg_file.Filter = "*.bmp|*.bmp|*.jpg|*.jpg|*.jpeg|*.jpeg|*.gif|*.gif|*.ico|*.ico| (所有文件)|*.*" dlg_file.FilterIndex = 6 'OPEN对话框 dlg_file.ShowOpen '获取上传图片的名称,不带路径的 Dim i As Integer Dim str_lfile As String 64 str_lfile = dlg_file.FileName Do While Right(str_lfile, 1) <> "\" str_lfile = Left(str_lfile, Len(str_lfile) - 1) i = i + 1 Loop 'txt_sczp.Text = Right(dlg_file.FileName, i) str_filename = Right(dlg_file.FileName, i) '显示图片 txt_zp = str_filename pic_view.Picture = LoadPicture(dlg_file.FileName) '重画照片 pic_view.Height = pic_view.Height pic_view.Width = pic_view.Width pic_view.PaintPicture pic_view, 0, 0, pic_view.Width, pic_view.Height Exit Sub ErrorHandle: If Err.Number = 32755 Then Exit Sub MsgBox "图形加载错误!", vbExclamation, "提示" '加载错误后,清空所有信息 txt_zp = "" dlg_file.FileName = "" End Sub 65 '保存当前数据 Private Function save_date() '保存信息 Dim ls_xb As String If opt_male.Value = True Then ls_xb = "男" Else ls_xb = "女" End If mrc.Fields("xh") = txt_xh mrc.Fields("xm") = txt_xm mrc.Fields("xb") = ls_xb mrc.Fields("yuan") = txt_yuan mrc.Fields("xi") = txt_xi mrc.Fields("zy") = txt_zy mrc.Fields("nj") = txt_nj mrc.Fields("bj") = txt_bj mrc.Fields("zp") = txt_zp mrc.Fields("jg") = txt_jg mrc.Fields("zzmm") = txt_zzmm mrc.Fields("fmxm") = txt_fmxm 66 mrc.Fields("sj") = txt_sj mrc.Fields("jtdh") = txt_jtdh mrc.Fields("dwdh") = txt_dwdh mrc.Fields("jtzz") = txt_jtzz mrc.Fields("xjbdqk") = cmb_xjbdqk mrc.Fields("hdjl") = txt_hdjl mrc.Fields("cfqk") = txt_cfqk For i = 0 To 18 If IsNull(mrc.Fields(i)) Then mrc.Fields(i) = "" End If Next mrc.Update '保存成功标志 If dlg_file.FileName <> "" Then '复制照片 On Error Resume Next FileCopy dlg_file.FileName, App.Path & "\pictrue\" & ls_tpmc '清空文件 dlg_file.FileName = "" 67 End If '保存现在的图片路径 dlg_file.FileName = App.Path & "\pictrue\" & txt_zp ' If pi_operation = 0 Then ' txt_zp = ls_tpmc ' End If '保存成功后在用户管理表插入一笔数据 If Pi_operation = 0 Then Str_sql = "insert into xt_user(yhzh,yhmm,yhlx) values('" & txt_xh & "','" & txt_xh & "','" & "学生')" Set mrc = ExecuteSQL(Str_sql) End If Pi_operation = 1 Ps_xh = txt_xh.Text MsgBox "数据保存成功!", vbDefaultButton1, "提示" End Function ' Private Function show_date() 68 '显示学员的信息 If mrc.EOF = False Then txt_xh = mrc.Fields("xh") txt_xm = mrc.Fields("xm") If mrc.Fields("xb") = "男" Then opt_male.Value = True Else opt_female.Value = True End If txt_yuan = mrc.Fields("yuan") txt_xi = mrc.Fields("xi") txt_zy = mrc.Fields("zy") txt_nj = mrc.Fields("nj") txt_bj = mrc.Fields("bj") txt_zp = mrc.Fields("zp") txt_jg = mrc.Fields("jg") txt_zzmm = mrc.Fields("zzmm") txt_fmxm = mrc.Fields("fmxm") txt_sj = mrc.Fields("sj") txt_jtdh = mrc.Fields("jtdh") txt_dwdh = mrc.Fields("dwdh") txt_jtzz = mrc.Fields("jtzz") 69 cmb_xjbdqk = mrc.Fields("xjbdqk") txt_hdjl = mrc.Fields("hdjl") txt_cfqk = mrc.Fields("cfqk") '显示照片 If txt_zp <> "" Then '跳开错误 On Error Resume Next '跳转到错误提示信息 On Error GoTo ErrorHandle2 pic_view.Picture = LoadPicture(App.Path & "\pictrue\" & txt_zp) pic_view.Height = pic_view.Height pic_view.Width = pic_view.Width pic_view.PaintPicture pic_view, 0, 0, pic_view.Width, pic_view.Height '保存现在的图片路径 dlg_file.FileName = App.Path & "\pictrue\" & txt_zp End If Else MsgBox "数据加载出错,请重新操作!", vbDefaultButton1, 70 "提示" End End If ErrorHandle2: If Err.Number = 32755 Then Exit Function If Err.Number = 53 Then MsgBox "照片不存在!", vbExclamation, "提示" End Function Private Sub cmd_save_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统 自动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出 系统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub 71 End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, "提示" Exit Sub End If '判断各字段是否符合要求 If Trim(txt_xh.Text) = "" Then MsgBox "学员证号不能为空!", vbOKOnly, "提示" txt_xh.SetFocus Exit Sub End If If Ps_yhlx = "学生" Then If Trim(txt_jg.Text) = "" Then MsgBox "籍贯不能为空!", vbOKOnly, "提示" txt_jg.SetFocus Exit Sub End If End If If txt_zp <> "" Then ls_tpmc = txt_zp If Pi_operation = 0 Then 72 Str_sql = "select * from xt_student where zp= '" & ls_tpmc & "'" ElseIf Pi_operation = 1 Then Str_sql = "select * from xt_student where zp= '" & ls_tpmc & "' and " & "xh<> '" & Ps_xh & "'" End If Set mrc = ExecuteSQL(Str_sql) If mrc.RecordCount > 0 Then MsgBox "该相片名称已经存在,请修改相片名称后再保 存!", vbDefaultButton1, "提示" cmd_open.SetFocus Exit Sub End If End If '新增保存 If Pi_operation = 0 Then Ps_xh = txt_xh Str_sql = "select * from xt_student where xh= '" & Ps_xh & "'" Set mrc = ExecuteSQL(Str_sql) If mrc.RecordCount > 0 Then MsgBox "该学员证号已经存在,请重新输入!", 73 vbDefaultButton1, "提示" Ps_xh = "" txt_xh.Text = "" txt_xh.SetFocus mrc.Close Else Str_sql = "select * from xt_student" Set mrc = ExecuteSQL(Str_sql) mrc.AddNew b_save = save_date() End If '修改保存 ElseIf Pi_operation = 1 Then Str_sql = "select * from xt_student where xh= '" & Ps_xh & "'" Set mrc = ExecuteSQL(Str_sql) b_save = save_date() End If End Sub Function set_enabled1(b_xs As Boolean) txt_xh.Enabled = b_xs txt_xm.Enabled = b_xs opt_male.Enabled = b_xs opt_female.Enabled = b_xs 74 txt_yuan.Enabled = b_xs txt_xi.Enabled = b_xs txt_zy.Enabled = b_xs txt_nj.Enabled = b_xs txt_bj.Enabled = b_xs txt_zp.Enabled = b_xs cmd_open.Enabled = b_xs End Function Function set_enabled2(b_xs As Boolean) txt_jg.Enabled = b_xs txt_zzmm.Enabled = b_xs txt_fmxm.Enabled = b_xs txt_sj.Enabled = b_xs txt_jtdh.Enabled = b_xs txt_dwdh.Enabled = b_xs txt_jtzz.Enabled = b_xs End Function Function set_enabled3(b_xs As Boolean) cmb_xjbdqk.Enabled = b_xs txt_hdjl.Enabled = b_xs txt_cfqk.Enabled = b_xs End Function 75 Private Sub Form_Activate() Ps_window = "frm_student" End Sub Private Sub Form_Load() Me.Width = 9420 Me.Height = 9855 Me.Left = (mdi_main.Width - Me.Width) / 2 Me.Top = 0 nf_student.LoadSkin nf_student.MnuStyleIdx '载入界面样式, 为了使界面和菜单对应,所以使用NiceForm的MnuStyleIdx为参数 nf_student.AutoSkinControl '让控件自动设计窗体上的其它Nice控件的界面样式 '初始化默认 If Pi_operation = 0 Then opt_male.Value = True ElseIf Pi_operation = 1 Then Str_sql = "select * from xt_student where xh= '" & Ps_xh & "'" Set mrc = ExecuteSQL(Str_sql) '显示指定学员的信息 b_show = show_date() 76 txt_xh.Enabled = False ElseIf Pi_operation = 2 Then Str_sql = "select * from xt_student where xh= '" & Ps_xh & "'" Set mrc = ExecuteSQL(Str_sql) '显示指定学员的信息 b_show = show_date() set_enabled1 (False) set_enabled2 (False) set_enabled3 (False) cmd_save.Visible = False End If End Sub Private Sub NiceButton1_Click() MsgBox Me.Left & "," & Me.Top & "," & Me.Width & "," & Me.Height End Sub Private Sub NiceContainr5_GotFocus() End Sub 4. 5 77 本窗口实现对老师信息的录入,修改,查看.界面如下: 代码如下: '存放上传照片名称,无路径的 Dim ls_tpmc As String Private Sub cmb_exit_Click() If Pi_operation = 0 Or Pi_operation = 1 Then b = frm_main.init_xllb(frm_main.cmb_lx) Call frm_main.cmd_search_Click End If Unload Me End Sub 78 '保存当前数据 Private Function save_date() '保存信息 Dim ls_xb As String If opt_male.Value = True Then ls_xb = "男" Else ls_xb = "女" End If mrc.Fields("bh") = txt_bh mrc.Fields("xm") = txt_xm mrc.Fields("xb") = ls_xb mrc.Fields("nl") = txt_nl mrc.Fields("jg") = txt_jg mrc.Fields("lxdh") = txt_lxdh mrc.Fields("lxdz") = txt_lxdz mrc.Fields("yx") = txt_yx mrc.Fields("zc") = txt_zc mrc.Fields("zw") = txt_zw mrc.Fields("bz") = txt_bz 79 For i = 0 To 10 If IsNull(mrc.Fields(i)) Then mrc.Fields(i) = "" End If Next mrc.Update Set mrc = Nothing '保存成功后在用户管理表插入一笔数据 If Pi_operation = 0 Then Str_sql = "insert into xt_user(yhzh,yhmm,yhlx) values('" & txt_bh & "','" & txt_bh & "','" & "老师')" Set mrc = ExecuteSQL(Str_sql) End If Pi_operation = 1 Ps_bh = txt_bh.Text MsgBox "数据保存成功!", vbDefaultButton1, "提示" End Function 80 ' Private Function show_date() '显示学员的信息 If mrc.EOF = False Then txt_bh = mrc.Fields("bh") txt_xm = mrc.Fields("xm") If mrc.Fields("xb") = "男" Then opt_male.Value = True Else opt_female.Value = True End If txt_nl = mrc.Fields("nl") txt_jg = mrc.Fields("jg") txt_lxdh = mrc.Fields("lxdh") txt_lxdz = mrc.Fields("lxdz") txt_yx = mrc.Fields("yx") txt_zc = mrc.Fields("zc") txt_zw = mrc.Fields("zw") txt_bz = mrc.Fields("bz") Else MsgBox "数据加载出错,请重新操作!", vbDefaultButton1, " 提示" End 81 End If ErrorHandle2: If Err.Number = 32755 Then Exit Function If Err.Number = 53 Then MsgBox "照片不存在!", vbExclamation, "提示" End Function Private Sub cmd_save_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自 动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms Unload Form Next Form frm_login.Show End If Exit Sub End If 82 If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" Exit Sub End If '判断各字段是否符合要求 If Trim(txt_bh.Text) = "" Then MsgBox "编号不能为空,请重新输入!", vbOKOnly, "提示" txt_bh.SetFocus Exit Sub End If '新增保存 If Pi_operation = 0 Then Ps_bh = txt_bh Str_sql = "select * from xt_teacher where bh= '" & Ps_bh & "'" Set mrc = ExecuteSQL(Str_sql) If mrc.RecordCount > 0 Then MsgBox "该编号已经存在,请重新输入!", vbDefaultButton1, "提示" Ps_bh = "" txt_bh.Text = "" txt_bh.SetFocus 83 mrc.Close Else Str_sql = "select * from xt_teacher" Set mrc = ExecuteSQL(Str_sql) mrc.AddNew b_save = save_date() End If '修改保存 ElseIf Pi_operation = 1 Then Str_sql = "select * from xt_teacher where bh= '" & Ps_bh & "'" Set mrc = ExecuteSQL(Str_sql) b_save = save_date() End If End Sub Function set_enabled(b_xs As Boolean) txt_bh.Enabled = b_xs txt_xm.Enabled = b_xs opt_male.Enabled = b_xs opt_female.Enabled = b_xs txt_nl.Enabled = b_xs txt_jg.Enabled = b_xs txt_lxdh.Enabled = b_xs txt_lxdz.Enabled = b_xs 84 txt_yx.Enabled = b_xs txt_zc.Enabled = b_xs txt_zw.Enabled = b_xs txt_bz.Enabled = b_xs End Function Private Sub Form_Activate() Ps_window = "frm_teacher" End Sub Private Sub Form_Load() Me.Width = 7605 Me.Height = 6645 Me.Left = (mdi_main.Width - Me.Width) / 2 Me.Top = 0 nf_teacher.LoadSkin nf_teacher.MnuStyleIdx '载入界面样式,为 了使界面和菜单对应,所以使用NiceForm的MnuStyleIdx为参数 nf_teacher.AutoSkinControl '让控件自动设计窗体上的其它Nice 控件的界面样式 '初始化默认 If Pi_operation = 0 Then 85 opt_male.Value = True ElseIf Pi_operation = 1 Then Str_sql = "select * from xt_teacher where bh= '" & Ps_bh & "'" Set mrc = ExecuteSQL(Str_sql) '显示指定学员的信息 b_show = show_date() txt_bh.Enabled = False ElseIf Pi_operation = 2 Then Str_sql = "select * from xt_teacher where bh= '" & Ps_bh & "'" Set mrc = ExecuteSQL(Str_sql) '显示指定学员的信息 b_show = show_date() set_enabled (False) cmd_save.Visible = False End If End Sub 本窗口实现对不同对象的登陆密码进行修改,界面如下: 86 实现代码如下: Private Sub cmd_cancle_Click() Unload Me End Sub Private Sub cmd_sure_Click() If Pb_time = True Then If MsgBox(" 由于你15分钟用户对电脑未作任何操作,系统自动断开连接,请问是否要重新连接?", vbQuestion + vbYesNo, "退出系 统") = vbNo Then For Each Form In Forms Unload Form Next Form Else Pb_time = False For Each Form In Forms 87 Unload Form Next Form frm_login.Show End If Exit Sub End If If Pi_sjk = 0 Then MsgBox "数据库已经断开,请重新连接", vbDefaultButton1, " 提示" Exit Sub End If If Trim(txt_yhzh.Text) = "" Then MsgBox "用户帐户不能为空!", vbOKOnly, "提示" txt_yhzh.SetFocus Exit Sub End If If Trim(cmb_yhlx.Text) = "" Then MsgBox "请选择所在类型!", vbOKOnly, "提示" cmb_yhlx.SetFocus Exit Sub End If 88 If Trim(txt_new_mm.Text) <> Trim(txt_sure_mm.Text) Then MsgBox "新密码与确认密码不一致,请重新输入!", vbOKOnly, " 提示" txt_new_mm.SetFocus Exit Sub End If Str_sql = "select * from xt_user where dbo.StrComp(yhmm, '" & txt_yhmm & "')=1 and yhmm= '" & txt_yhmm & "' and yhzh= '" & txt_yhzh & "' and yhlx= '" & cmb_yhlx & "'" Set mrc = ExecuteSQL(Str_sql) If mrc.RecordCount > 0 Then Str_sql = "update xt_user set yhmm='" & txt_new_mm & "' where dbo.StrComp(yhmm, '" & txt_yhmm & "')=1 and yhmm= '" & txt_yhmm & "' and yhzh= '" & txt_yhzh & "' and yhlx= '" & cmb_yhlx & "'" Set mrc = ExecuteSQL(Str_sql) MsgBox "修改成功!", vbDefaultButton1, "提示" Else MsgBox "登陆失败,请注意大小写,输入正确的用户名或密码", vbDefaultButton1, "提示" End If End Sub 89 Private Sub Form_Activate() Ps_window = "frm_modify" End Sub Private Sub Form_Load() nf_modify.LoadSkin nf_modify.MnuStyleIdx '载入界面样式,为了 使界面和菜单对应,所以使用NiceForm的MnuStyleIdx为参数 nf_modify.AutoSkinControl '让控件自动设计窗体上的其它Nice控 件的界面样式 End Sub 第五章全文总结 在本系统的开发过程中,由于本人是初次开发软件,在知识、经验方 面都存在着不足。另外,在整个开发的过程中,时间也比较仓促。因此, 该系统必然会存在一些缺陷和不足。虽然网络在学生档案管理系统中的应 用不是很多,但是未来的发展方向,在本次开发过程由于硬件的限制,未 能实现网络功能,因此在以后的系统更新过程中可能会造成一些不必要的 数据损失。 尽管本管理系统存在着很多不足,但其功能全面、易于日后程序更新、 数据库管理容易、界面友好、操作方便、效率高、安全性好等优点是本管 理系统所必需的。通过开发这个系统,我掌握了基本的开发过程,了解基 本知识并巩固了对MS Visual Basic 6.0的学习,但在这次毕业设计中的最 90 大收获不但掌握这几门开发工具的应用,而且学会了设计系统的思维方 法,以及与同学们之间合作的精神。 致 谢 在论文即将完成之际,回顾紧张但又充实的学习、开发过程,本人在 此向所有关心我的及帮助我的老师和同学们致以最真诚的感谢。 在本次毕业设计中,我从指导老师--------刘老师,身上学到了很多东 西。他认真负责的工作态度,严谨的治学精神和深厚的理论水平都使我收 益匪浅。他无论在理论上还是在实践中,都给与我很大的帮助,使我得到 很大的提高,这对于我以后的工作和学习都有一种巨大的帮助,在此感谢 他耐心的辅导。在撰写论文阶段,刘老师几次审阅我们的论文,提 出了 许多宝贵意见,没有她的指导,我们就不能较好的完成课题设计的任务。 另外,我还要感谢在这几年来对我有所教导的老师,他们孜孜不倦的教诲不但让我学到了很多知识,而且让我掌握了学习的方法, 更教会了我做人处事的道理,在此表示感谢。同时,在系统开发 过程中还有同组的同学也给了我不少帮助,这里一并表示感谢。 91 参考文献 [1] 周佩德.《数据库原理及应用》.电子工业出版社 [2] 刘炳文等,VISUAL BASIC程序设计——数据库篇,1999 [3] 李光明.《Visual Basic 6.0编程实例大制作》.冶金工业出版社 [4] 刘炳文,精通VISUAL BASIC 6.0入门与提高,人民邮电出版社 [5] 黄淼云.《VB6.0办公自动化编程》.国防工业出版社 [6] 王要武,管理系统,电子工业出版社,2003 [7] 李红等编著,管理信息系统开发与应用,电子工业出版社,2003 [8] 周之英缟著,现代软件工程,科学出版社,2003 [9] 康博工作室,张红军,王红等缟著《Visual Basic 6.0中文版高级 应用与开发指南》,人民邮电出版社,2001年4月第一版 [10] 林立军,程斌,翁迪恩缟著《Visual Basic 6.0数据库开发指南》, 西安电子科技大学出版社,2000年2月第一版 [11] 张宏林,孔艳,王哲等编著。《按实例学Visual Basic 6.0>北京, 人民邮电出版社,2000 [12] 宋伟,吴建国等编著《中文Visual Basic 6.0编程基础》,北京, 清华大学出版社 [13] [美]Jeffrey P.McManus著赵学锁,龚波,李志,曹天伟等译《Visual Basic 6.0数据库存访问技术》,2000年3月第一版 92
本文档为【学生档案管理系统-毕业论文】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_435706
暂无简介~
格式:doc
大小:317KB
软件:Word
页数:0
分类:
上传时间:2017-09-01
浏览量:29