龙空技术网

学生考试管理系统 Access数据库管理系统设计制作课程实例

凌霄百科 217

前言:

现在姐妹们对“c语言学生证管理系统设计”大约比较看重,姐妹们都想要学习一些“c语言学生证管理系统设计”的相关知识。那么小编同时在网摘上汇集了一些对于“c语言学生证管理系统设计””的相关文章,希望咱们能喜欢,你们快快来学习一下吧!

系统介绍

本系统包含主要功能有:学生管理,考试管理,考场管理,考试安排,考试成绩统计,生成报表。

商品中包含简要的设计报告(功能模块图,业务流程图,UC矩阵,数据流图,数据字典,E-R图等)和制作截图文档。

数据库系统包含:表,查询,窗体,报表,VBA代码

系统为单机使用的access数据库系统,可作为课程学习实例使用。

设计部分

功能模块图

业务流程图

数据流图

E-R图

程序流程图

关系模型

考试(考试名称,科目,考试日期,考试时间)

考试安排(学号,考试,考场,座位,监考员,成绩,状态)

考场(考场名称,考场座位,状态)

学生(学号,姓名,性别,班级)

监考员(监考员,监考科目,联系电话)

系统部分

表关系

窗体

考试安排

考场管理

考试管理

学生管理

考试统计

报表

考试安排报表

考试统计报表

代码部分

系统主页

Private Sub Command监考管理_Click()

Me.显示界面子窗体.SourceObject = "监考员管理"

Me.显示界面子窗体.SetFocus

End Sub

Private Sub Command考场管理_Click()

Me.显示界面子窗体.SourceObject = "考场管理"

Me.显示界面子窗体.SetFocus

End Sub

Private Sub Command考试安排_Click()

Me.显示界面子窗体.SourceObject = "考试安排管理"

Me.显示界面子窗体.SetFocus

End Sub

Private Sub Command考试管理_Click()

Me.显示界面子窗体.SourceObject = "考试管理"

Me.显示界面子窗体.SetFocus

End Sub

Private Sub Command考试统计_Click()

Me.显示界面子窗体.SourceObject = "考试统计"

Me.显示界面子窗体.SetFocus

End Sub

Private Sub Command退出系统_Click()

If MsgBox("是否退出系统", vbYesNo) <> vbYes Then

Exit Sub

End If

Application.Quit acQuitSaveAll

End Sub

Private Sub Command系统后台_Click()

DoCmd.Close acForm, Me.Name

DoCmd.SelectObject acForm, , True

End Sub

Private Sub Command学生管理_Click()

Me.显示界面子窗体.SourceObject = "学生管理"

Me.显示界面子窗体.SetFocus

End Sub

监考员管理

Private Sub Command查询_Click()

On Error GoTo 结束查询

If 查询内容 <> "" And IsNull(查询内容) = False And 查询字段 <> "" And IsNull(查询字段) = False Then

Me.数据表子窗体.Form.Filter = Me.查询字段 & " like '*" & Me.查询内容 & "*'"

Me.数据表子窗体.Form.FilterOn = True

Me.数据表子窗体.Requery

Else

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End If

Me.数据表子窗体.SetFocus

Exit Sub

结束查询:

MsgBox Err.Description

End Sub

Private Sub Command清空_Click()

监考员.Value = ""

监考科目.Value = ""

联系电话.Value = ""

End Sub

Private Sub Command全部_Click()

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End Sub

Private Sub Command添加_Click()

If 监考员 = "" Or IsNull(监考员) = True Then

MsgBox "监考员值为空!"

Exit Sub

End If

If 监考科目 = "" Or IsNull(监考科目) = True Then

MsgBox "监考科目值为空!"

Exit Sub

End If

If 联系电话 = "" Or IsNull(联系电话) = True Then

MsgBox "联系电话值为空!"

Exit Sub

End If

If Nz(DCount("监考员", "监考员表", "监考员='" & Me.监考员 & "'"), 0) > 0 Then

MsgBox "该监考员已存在!不能重复"

Exit Sub

End If

On Error Resume Next

DoCmd.SetWarnings (False)

Dim add_sql As String

add_sql = "Insert Into 监考员表 (监考员,监考科目,联系电话) Values ('" & 监考员 & "','" & 监考科目 & "','" & 联系电话 & "')"

DoCmd.RunSQL add_sql

MsgBox "添加完成"

Me.数据表子窗体.Form.Requery

End Sub

监考员数据表

Private Sub Form_BeforeUpdate(Cancel As Integer)

If 监考员.Value <> "" And 监考科目.Value <> "" And 联系电话.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

If (MsgBox("是否保存对记录的修改", 1, "修改记录提醒") = 1) Then

Beep

Else

DoCmd.RunCommand acCmdUndo

End If

Else

MsgBox "监考员,监考科目,联系电话都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

Private Sub 监考员_DblClick(Cancel As Integer)

If MsgBox("是否删除该记录:" & Me.监考员 & "?", vbYesNo) = vbYes Then

DoCmd.SetWarnings (False)

Dim del_sql As String

del_sql = "Delete From 监考员表 Where 监考员 = '" & Me.监考员 & "'"

DoCmd.RunSQL del_sql

Me.Requery

End If

End Sub

考场管理

Private Sub Command查询_Click()

On Error GoTo 结束查询

If 查询内容 <> "" And IsNull(查询内容) = False And 查询字段 <> "" And IsNull(查询字段) = False Then

Me.数据表子窗体.Form.Filter = Me.查询字段 & " like '*" & Me.查询内容 & "*'"

Me.数据表子窗体.Form.FilterOn = True

Me.数据表子窗体.Requery

Else

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End If

Me.数据表子窗体.SetFocus

Exit Sub

结束查询:

MsgBox Err.Description

End Sub

Private Sub Command清空_Click()

考场名称.Value = ""

考场座位.Value = ""

状态.Value = ""

End Sub

Private Sub Command全部_Click()

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End Sub

Private Sub Command添加_Click()

If 考场名称 = "" Or IsNull(考场名称) = True Then

MsgBox "考场名称值为空!"

Exit Sub

End If

If 考场座位 = "" Or IsNull(考场座位) = True Then

MsgBox "考场座位值为空!"

Exit Sub

End If

If 状态 = "" Or IsNull(状态) = True Then

MsgBox "状态值为空!"

Exit Sub

End If

If Nz(DCount("考场名称", "考场表", "考场名称='" & Me.考场名称 & "' and 考场座位='" & Me.考场座位 & "'"), 0) > 0 Then

MsgBox "该考场名称座位已存在!不能重复"

Exit Sub

End If

On Error Resume Next

DoCmd.SetWarnings (False)

Dim add_sql As String

add_sql = "Insert Into 考场表 (考场名称,考场座位,状态) Values ('" & 考场名称 & "','" & 考场座位 & "','" & 状态 & "')"

DoCmd.RunSQL add_sql

MsgBox "添加完成"

Me.数据表子窗体.Form.Requery

End Sub

考场数据表

Private Sub Form_BeforeUpdate(Cancel As Integer)

If 考场名称.Value <> "" And 考场座位.Value <> "" And 状态.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

If (MsgBox("是否保存对记录的修改", 1, "修改记录提醒") = 1) Then

Beep

Else

DoCmd.RunCommand acCmdUndo

End If

Else

MsgBox "考场名称,考场座位,状态都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

Private Sub 考场名称_DblClick(Cancel As Integer)

If MsgBox("是否删除该记录:" & Me.考场名称 & "?", vbYesNo) = vbYes Then

DoCmd.SetWarnings (False)

Dim del_sql As String

del_sql = "Delete From 考场表 Where 考场名称 = '" & Me.考场名称 & "'"

DoCmd.RunSQL del_sql

Me.Requery

End If

End Sub

考试安排管理

Private Sub Command报表_Click()

If Me.数据表子窗体.Form.FilterOn = True Then

DoCmd.OpenReport "考试安排报表", acViewReport, , Me.数据表子窗体.Form.Filter

Else

DoCmd.OpenReport "考试安排报表", acViewReport

End If

End Sub

Private Sub Command查询_Click()

On Error GoTo 结束查询

If 查询内容 <> "" And IsNull(查询内容) = False And 查询字段 <> "" And IsNull(查询字段) = False Then

Me.数据表子窗体.Form.Filter = Me.查询字段 & " like '*" & Me.查询内容 & "*'"

Me.数据表子窗体.Form.FilterOn = True

Me.数据表子窗体.Requery

Else

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End If

Me.数据表子窗体.SetFocus

Exit Sub

结束查询:

MsgBox Err.Description

End Sub

Private Sub Command清空_Click()

学号.Value = ""

考试.Value = ""

考场.Value = ""

座位.Value = ""

监考员.Value = ""

成绩.Value = ""

状态.Value = ""

End Sub

Private Sub Command全部_Click()

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End Sub

Private Sub Command添加_Click()

If 学号 = "" Or IsNull(学号) = True Then

MsgBox "学号值为空!"

Exit Sub

End If

If 考试 = "" Or IsNull(考试) = True Then

MsgBox "考试值为空!"

Exit Sub

End If

If 考场 = "" Or IsNull(考场) = True Then

MsgBox "考场值为空!"

Exit Sub

End If

If 座位 = "" Or IsNull(座位) = True Then

MsgBox "座位值为空!"

Exit Sub

End If

On Error Resume Next

Dim add_rs As DAO.Recordset

Set add_rs = CurrentDb.OpenRecordset("考试安排表", dbOpenTable)

With add_rs

.AddNew

!学号.Value = 学号.Value

!考试.Value = 考试.Value

!考场.Value = 考场.Value

!座位.Value = 座位.Value

!监考员.Value = 监考员.Value

!成绩.Value = 成绩.Value

!状态.Value = 状态.Value

.Update

.Close

End With

Set add_rs = Nothing

MsgBox "添加完成"

Me.数据表子窗体.Form.Requery

End Sub

Private Sub 考场_AfterUpdate()

If Me.考场 <> "" Then

Me.座位.RowSource = "Select 考场座位,状态 From 考场表 where 考场名称='" & Me.考场 & "'"

Me.座位 = ""

Me.座位.Requery

Else

Me.座位.RowSource = "Select 考场座位,状态 From 考场表"

Me.座位 = ""

Me.座位.Requery

End If

End Sub

Private Sub 考场_Change()

If Me.考场 <> "" Then

Me.座位.RowSource = "Select 考场座位,状态 From 考场表 where 考场名称='" & Me.考场 & "'"

Me.座位 = ""

Me.座位.Requery

Else

Me.座位.RowSource = "Select 考场座位,状态 From 考场表"

Me.座位 = ""

Me.座位.Requery

End If

End Sub

考试管理

Private Sub Command查询_Click()

On Error GoTo 结束查询

If 查询内容 <> "" And IsNull(查询内容) = False And 查询字段 <> "" And IsNull(查询字段) = False Then

Me.数据表子窗体.Form.Filter = Me.查询字段 & " like '*" & Me.查询内容 & "*'"

Me.数据表子窗体.Form.FilterOn = True

Me.数据表子窗体.Requery

Else

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End If

Me.数据表子窗体.SetFocus

Exit Sub

结束查询:

MsgBox Err.Description

End Sub

Private Sub Command清空_Click()

考试名称.Value = ""

科目.Value = ""

考试日期.Value = ""

考试时间.Value = ""

End Sub

Private Sub Command全部_Click()

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End Sub

Private Sub Command添加_Click()

If 考试名称 = "" Or IsNull(考试名称) = True Then

MsgBox "考试名称值为空!"

Exit Sub

End If

If 科目 = "" Or IsNull(科目) = True Then

MsgBox "科目值为空!"

Exit Sub

End If

If 考试日期 = "" Or IsNull(考试日期) = True Then

MsgBox "考试日期值为空!"

Exit Sub

End If

If 考试时间 = "" Or IsNull(考试时间) = True Then

MsgBox "考试时间值为空!"

Exit Sub

End If

If Nz(DCount("考试名称", "考试表", "考试名称='" & Me.考试名称 & "'"), 0) > 0 Then

MsgBox "该考试名称已存在!不能重复"

Exit Sub

End If

On Error Resume Next

DoCmd.SetWarnings (False)

Dim add_sql As String

add_sql = "Insert Into 考试表 (考试名称,科目,考试日期,考试时间) Values ('" & 考试名称 & "','" & 科目 & "',#" & 考试日期 & "#,'" & 考试时间 & "')"

DoCmd.RunSQL add_sql

MsgBox "添加完成"

Me.数据表子窗体.Form.Requery

End Sub

考试数据表

Private Sub Form_BeforeUpdate(Cancel As Integer)

If 考试名称.Value <> "" And 科目.Value <> "" And 考试日期.Value <> "" And 考试时间.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

If (MsgBox("是否保存对记录的修改", 1, "修改记录提醒") = 1) Then

Beep

Else

DoCmd.RunCommand acCmdUndo

End If

Else

MsgBox "考试名称,科目,考试日期,考试时间都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

Private Sub 考试名称_DblClick(Cancel As Integer)

DoCmd.OpenForm "考试信息管理", acNormal, , "考试名称='" & 考试名称 & "'"

End Sub

考试统计

Private Sub Command报表_Click()

If Me.数据表子窗体.Form.FilterOn = True Then

DoCmd.OpenReport "考试统计报表", acViewReport, , Me.数据表子窗体.Form.Filter

Else

DoCmd.OpenReport "考试统计报表", acViewReport

End If

End Sub

Private Sub Command查询_Click()

On Error GoTo 结束查询

If 查询内容 <> "" And IsNull(查询内容) = False And 查询字段 <> "" And IsNull(查询字段) = False Then

Me.数据表子窗体.Form.Filter = Me.查询字段 & " like '*" & Me.查询内容 & "*'"

Me.数据表子窗体.Form.FilterOn = True

Me.数据表子窗体.Requery

Else

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End If

Me.数据表子窗体.SetFocus

Exit Sub

结束查询:

MsgBox Err.Description

End Sub

Private Sub Command清空_Click()

考场名称.Value = ""

考场座位.Value = ""

状态.Value = ""

End Sub

Private Sub Command全部_Click()

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End Sub

Private Sub Command添加_Click()

If 考场名称 = "" Or IsNull(考场名称) = True Then

MsgBox "考场名称值为空!"

Exit Sub

End If

If 考场座位 = "" Or IsNull(考场座位) = True Then

MsgBox "考场座位值为空!"

Exit Sub

End If

If 状态 = "" Or IsNull(状态) = True Then

MsgBox "状态值为空!"

Exit Sub

End If

If Nz(DCount("考场名称", "考场表", "考场名称='" & Me.考场名称 & "' and 考场座位='" & Me.考场座位 & "'"), 0) > 0 Then

MsgBox "该考场名称座位已存在!不能重复"

Exit Sub

End If

On Error Resume Next

DoCmd.SetWarnings (False)

Dim add_sql As String

add_sql = "Insert Into 考场表 (考场名称,考场座位,状态) Values ('" & 考场名称 & "','" & 考场座位 & "','" & 状态 & "')"

DoCmd.RunSQL add_sql

MsgBox "添加完成"

Me.数据表子窗体.Form.Requery

End Sub

考试信息管理

Private Sub Command更新_Click()

If 考试名称.Value <> "" And 科目.Value <> "" And 考试日期.Value <> "" And 考试时间.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

DoCmd.RunCommand acCmdSaveRecord

Else

MsgBox "考试名称,科目,考试日期,考试时间都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

Private Sub Command删除_Click()

On Error Resume Next

DoCmd.RunCommand acCmdSaveRecord

DoCmd.SetWarnings (False)

If MsgBox("是否删除该记录:" & Me.考试名称, vbYesNo) = vbYes Then

DoCmd.SetWarnings (False)

Dim del_sql As String

del_sql = "Delete From 考试表 Where 考试名称 = '" & Me.考试名称 & "'"

DoCmd.RunSQL del_sql

MsgBox "删除成功"

Forms("系统主页").显示界面子窗体.Form.数据表子窗体.Form.Requery

DoCmd.Close acForm, Me.Name

Else

Exit Sub

End If

If Error.Number <> 0 Then

MsgBox Error.Description

End If

End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

If 考试名称.Value <> "" And 科目.Value <> "" And 考试日期.Value <> "" And 考试时间.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

If (MsgBox("是否保存对记录的修改", 1, "修改记录提醒") = 1) Then

Beep

Else

DoCmd.RunCommand acCmdUndo

End If

Else

MsgBox "考试名称,科目,考试日期,考试时间都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

学生管理

Private Sub Command报表_Click()

If Me.数据表子窗体.Form.FilterOn = True Then

DoCmd.OpenReport "学生报表", acViewReport, , Me.数据表子窗体.Form.Filter

Else

DoCmd.OpenReport "学生报表", acViewReport

End If

End Sub

Private Sub Command查询_Click()

On Error GoTo 结束查询

If 查询内容 <> "" And IsNull(查询内容) = False And 查询字段 <> "" And IsNull(查询字段) = False Then

Me.数据表子窗体.Form.Filter = Me.查询字段 & " like '*" & Me.查询内容 & "*'"

Me.数据表子窗体.Form.FilterOn = True

Me.数据表子窗体.Requery

Else

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End If

Me.数据表子窗体.SetFocus

Exit Sub

结束查询:

MsgBox Err.Description

End Sub

Private Sub Command清空_Click()

学号.Value = ""

姓名.Value = ""

性别.Value = ""

班级.Value = ""

End Sub

Private Sub Command全部_Click()

Me.数据表子窗体.Form.FilterOn = False

Me.数据表子窗体.Requery

End Sub

Private Sub Command添加_Click()

If 学号 = "" Or IsNull(学号) = True Then

MsgBox "学号值为空!"

Exit Sub

End If

If 姓名 = "" Or IsNull(姓名) = True Then

MsgBox "姓名值为空!"

Exit Sub

End If

If 性别 = "" Or IsNull(性别) = True Then

MsgBox "性别值为空!"

Exit Sub

End If

If 班级 = "" Or IsNull(班级) = True Then

MsgBox "班级值为空!"

Exit Sub

End If

If Nz(DCount("学号", "学生表", "学号='" & Me.学号 & "'"), 0) > 0 Then

MsgBox "该学号已存在!不能重复"

Exit Sub

End If

On Error Resume Next

DoCmd.SetWarnings (False)

Dim add_sql As String

add_sql = "Insert Into 学生表 (学号,姓名,性别,班级) Values ('" & 学号 & "','" & 姓名 & "','" & 性别 & "','" & 班级 & "')"

DoCmd.RunSQL add_sql

MsgBox "添加完成"

Me.数据表子窗体.Form.Requery

End Sub

学生数据表

Private Sub Form_BeforeUpdate(Cancel As Integer)

If 学号.Value <> "" And 姓名.Value <> "" And 性别.Value <> "" And 班级.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

If (MsgBox("是否保存对记录的修改", 1, "修改记录提醒") = 1) Then

Beep

Else

DoCmd.RunCommand acCmdUndo

End If

Else

MsgBox "学号,姓名,性别,班级都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

Private Sub 学号_DblClick(Cancel As Integer)

DoCmd.OpenForm "学生信息管理", acNormal, , "学号='" & 学号 & "'"

End Sub

学生信息管理

Private Sub Command更新_Click()

If 学号.Value <> "" And 姓名.Value <> "" And 性别.Value <> "" And 班级.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

DoCmd.RunCommand acCmdSaveRecord

Else

MsgBox "学号,姓名,性别,班级都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

Private Sub Command删除_Click()

On Error Resume Next

DoCmd.RunCommand acCmdSaveRecord

DoCmd.SetWarnings (False)

If MsgBox("是否删除该记录:" & Me.学号, vbYesNo) = vbYes Then

DoCmd.SetWarnings (False)

Dim del_sql As String

del_sql = "Delete From 学生表 Where 学号 = '" & Me.学号 & "'"

DoCmd.RunSQL del_sql

MsgBox "删除成功"

Forms("系统主页").显示界面子窗体.Form.数据表子窗体.Form.Requery

DoCmd.Close acForm, Me.Name

Else

Exit Sub

End If

If Error.Number <> 0 Then

MsgBox Error.Description

End If

End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

If 学号.Value <> "" And 姓名.Value <> "" And 性别.Value <> "" And 班级.Value <> "" Then

On Error GoTo 数据更新前提醒_Err

If (MsgBox("是否保存对记录的修改", 1, "修改记录提醒") = 1) Then

Beep

Else

DoCmd.RunCommand acCmdUndo

End If

Else

MsgBox "学号,姓名,性别,班级都不能为空"

On Error Resume Next

DoCmd.RunCommand acCmdUndo

Exit Sub

End If

数据更新前提醒_Exit:

Exit Sub

数据更新前提醒_Err:

MsgBox Error$

Resume 数据更新前提醒_Exit

End Sub

如果需要做好的数据库系统文件和全部设计资料,可访问同名↓获取

标签: #c语言学生证管理系统设计