⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addmark.frm

📁 班里一位同学做的学生管理系统的课程实习
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMark 
   BackColor       =   &H8000000B&
   Caption         =   "成绩管理"
   ClientHeight    =   3660
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5115
   FillColor       =   &H00FF0000&
   ForeColor       =   &H8000000D&
   LinkTopic       =   "Form5"
   ScaleHeight     =   3660
   ScaleWidth      =   5115
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox cmbdepar 
      Height          =   315
      Left            =   3480
      TabIndex        =   16
      Top             =   1080
      Width           =   1575
   End
   Begin VB.ComboBox cmbCourse 
      Height          =   315
      Left            =   1200
      TabIndex        =   15
      Top             =   1080
      Width           =   1335
   End
   Begin VB.CommandButton cmdQuery 
      Caption         =   "查询"
      Height          =   375
      Left            =   3120
      TabIndex        =   14
      Top             =   2400
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "删除"
      Height          =   375
      Left            =   2280
      TabIndex        =   13
      Top             =   2400
      Width           =   855
   End
   Begin VB.CommandButton cmdChange 
      Caption         =   "修改"
      Height          =   375
      Left            =   1320
      TabIndex        =   12
      Top             =   2400
      Width           =   975
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   495
      Left            =   1440
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   3120
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   4080
      TabIndex        =   11
      Top             =   2400
      Width           =   975
   End
   Begin VB.CommandButton cmdaddmark 
      Caption         =   "添加"
      Height          =   375
      Left            =   360
      TabIndex        =   10
      Top             =   2400
      Width           =   975
   End
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   3360
      TabIndex        =   9
      Top             =   1800
      Width           =   1695
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   3480
      TabIndex        =   8
      Top             =   360
      Width           =   1095
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1200
      TabIndex        =   7
      Top             =   1800
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1200
      TabIndex        =   6
      Top             =   480
      Width           =   1215
   End
   Begin VB.Label Label6 
      Caption         =   "身份证号码"
      Height          =   255
      Left            =   2400
      TabIndex        =   5
      Top             =   1800
      Width           =   975
   End
   Begin VB.Label Label5 
      Caption         =   "系别"
      Height          =   375
      Left            =   2640
      TabIndex        =   4
      Top             =   1080
      Width           =   735
   End
   Begin VB.Label Label4 
      Caption         =   "考试编号"
      Height          =   375
      Left            =   2520
      TabIndex        =   3
      Top             =   480
      Width           =   855
   End
   Begin VB.Label Label3 
      Caption         =   "科目分数"
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   1800
      Width           =   735
   End
   Begin VB.Label Label2 
      Caption         =   "考试科目"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   1080
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "考生姓名"
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   480
      Width           =   855
   End
End
Attribute VB_Name = "frmMark"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub cmdaddmark_Click()

If flag = 2 Then
   MsgBox "您没有权限进行添加学籍!退出操作!!"
   Text1.Text = ""
   cmbCourse.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   cmbdepar.Text = ""
   Text6.Text = ""
   Text1.SetFocus
   Exit Sub
 End If

'判断基本信息不能为空!!
If Text1.Text = "" Then
   MsgBox "考生姓名不能为空,请重新输入!!!"
   Text1.SetFocus
   Exit Sub
   End If
If cmbCourse.Text = "" Then
   MsgBox "考试科目不能为空,请重新输入!!"
   cmbCourse.SetFocus
   Exit Sub
   End If
If Text3.Text = "" Then
   MsgBox "科目分数不能为空!!"
   Text3.SetFocus
   Exit Sub
   End If
If Text4.Text = "" Then
   MsgBox "考试编号不能为空!!"
   Text4.SetFocus
   Exit Sub
   End If
If cmbdepar.Text = "" Then
  MsgBox "系别不能为空!!!"
 cmbdepar.SetFocus
  Exit Sub
  End If
 If Text6.Text = "" Then
  MsgBox "身份证不能为空!!!"
  Text6.SetFocus
  Exit Sub
  End If

  '查找是否存在输入的身份证号这条记录
  Data1.Recordset.MoveFirst
 While Data1.Recordset.Fields("card_Id") <> Text6.Text Or Data1.Recordset.Fields("course") <> cmbCourse.Text
       Data1.Recordset.MoveNext
       If Data1.Recordset.EOF Then
         Data1.Recordset.AddNew
         Data1.Recordset.Fields("name") = Text1.Text
         Data1.Recordset.Fields("course") = cmbCourse.Text
         Data1.Recordset.Fields("mark") = Text3.Text
         Data1.Recordset.Fields("exam_Id") = Text4.Text
         Data1.Recordset.Fields("department") = cmbdepar.Text
         Data1.Recordset.Fields("card_Id") = Text6.Text
         Data1.Recordset.Update
         MsgBox "恭喜,添加成功!!!!"
         cmbCourse.Text = ""
         Text3.Text = ""
         Text4.Text = ""
         cmbdepar.Text = ""
         Text1.SetFocus
         Exit Sub
      End If
  Wend

   '提示已经添加,文本框清空
   MsgBox "该学生的该门课已经添加!!!!"
   cmbCourse.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   cmbdepar.Text = ""
   Text1.SetFocus
End Sub
Private Sub cmdcancel_Click()
Unload frmMark
End Sub

Private Sub cmdChange_Click()
If flag = 2 Then
 MsgBox "您没有权限进行修改学籍!退出操作!!"
   Text1.Text = ""
   cmbCourse.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   cmbdepar.Text = ""
   Text6.Text = ""
   Text1.SetFocus
   Exit Sub
 End If

'判断是否找出要修改的记录
If Text1.Text = "" Or cmbCourse.Text = "" Or Text6.Text = "" Or Text3.Text = "" Or Text4.Text = "" Then
    MsgBox "请先查找出您要修改的记录!谢谢合作!!"
    Exit Sub
End If

'修改记录

Data1.Recordset.Edit
Data1.Recordset.Fields("name") = Text1.Text
Data1.Recordset.Fields("course") = cmbCourse.Text
Data1.Recordset.Fields("mark") = Text3.Text
Data1.Recordset.Fields("exam_Id") = Text4.Text
Data1.Recordset.Fields("department") = cmbdepar.Text
Data1.Recordset.Fields("card_Id") = Text6.Text
Data1.Recordset.Update
MsgBox "修改成功,请确定!!!"
cmbCourse.Text = ""
Text3.Text = ""
Text4.Text = ""
cmbdepar.Text = ""
Text1.SetFocus

End Sub
Private Sub cmdQuery_Click()

'验证查询信息非空
If Text6.Text = "" Then
  MsgBox "查询成绩时,身份证号码不能为空!!!"
  Text6.SetFocus
  Exit Sub
End If
If cmbCourse.Text = "" Then
  MsgBox "查询成绩时,科目不能为空!!!"
  cmbCourse.SetFocus
  Exit Sub
End If
If Text1.Text = "" Then
  MsgBox "查询成绩时,考生姓名不能为空!!!"
  Text1.SetFocus
  Exit Sub
End If

'查看该学生的成绩记录是否存在
Data1.Recordset.MoveFirst
While Data1.Recordset.Fields("card_Id") <> Text6.Text Or Data1.Recordset.Fields("course") <> cmbCourse.Text
     Data1.Recordset.MoveNext
     If Data1.Recordset.EOF Then
        MsgBox "没有该学生的成绩,请重新输入身份证号码及姓名和科目!!"
        cmbCourse.Text = ""
        Text6.Text = ""
        Text1.SetFocus
     Exit Sub
     End If
Wend


'显示查到的记录
Text1.Text = Data1.Recordset.Fields("name")
cmbCourse.Text = Data1.Recordset.Fields("course")
Text3.Text = Data1.Recordset.Fields("mark")
Text4.Text = Data1.Recordset.Fields("exam_Id")
cmbdepar.Text = Data1.Recordset.Fields("department")
Text6.Text = Data1.Recordset.Fields("card_Id")
MsgBox "查询成功!请确定!!"

End Sub

Private Sub Command1_Click()
If flag = 2 Then
 MsgBox "您没有权限进行删除学籍!退出操作!!"
   Text1.Text = ""
  cmbCourse.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   cmbdepar.Text = ""
   Text6.Text = ""
   Text1.SetFocus
   Exit Sub
 End If
'提示要找出删除学生成绩的的记录
If Text1.Text = "" Then
  MsgBox "请先查询出要删除考生成绩的记录,再删除.谢谢!!!"
  Text1.SetFocus
  Exit Sub
End If
If cmbCourse.Text = "" Then
  MsgBox "请先查询出要删除考生成绩的记录,再删除.谢谢!!!"
  cmbCourse.SetFocus
  Exit Sub
End If
If Text6.Text = "" Then
  MsgBox "请先查询出要删除考生成绩的记录,再删除.谢谢!!!"
  Text6.SetFocus
  Exit Sub
End If
If Text3.Text = "" Then
  MsgBox "请先查询出要删除考生成绩的记录,再删除.谢谢!!!"
  Text3.SetFocus
  Exit Sub
End If
If Text4.Text = "" Then
  MsgBox "请先查询出要删除考生成绩的记录,再删除.谢谢!!!"
  Text4.SetFocus
  Exit Sub
End If
If cmbdepar.Text = "" Then
  MsgBox "请先查询出要删除考生成绩的记录,再删除.谢谢!!!"
   cmbdepar.SetFocus
  Exit Sub
End If
    Data1.Recordset.Delete
    MsgBox "删除成功!!"
    Text1.Text = ""
    cmbCourse.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   cmbdepar.Text = ""
   Text6.Text = ""
   Text1.SetFocus
End Sub

Private Sub Form_Load()
If flag = 2 Then
   Label1.ToolTipText = "您无权添加、删除、修改!"
   Text1.ToolTipText = "您无权添加、删除、修改!"
End If
cmbCourse.AddItem "数据库"
cmbCourse.AddItem "数据结构"
cmbCourse.AddItem "c语言"
cmbCourse.AddItem "操作系统"
cmbCourse.AddItem "c++程序设计"
cmbCourse.AddItem "心理学"
cmbCourse.AddItem "邓小平理论"
cmbdepar.AddItem "计算机系"
cmbdepar.AddItem "外国语学院"
cmbdepar.AddItem "文学院"
cmbdepar.AddItem "体育系"
cmbdepar.AddItem "化学系"
cmbdepar.AddItem "物电系"
cmbdepar.AddItem "数学系"
cmbdepar.AddItem "生物系"
cmbdepar.AddItem "贸经系"
cmbdepar.AddItem "艺术学院"
cmbdepar.AddItem "教育技术系"
Data1.Connect = "Access"
Data1.DatabaseName = "" & App.Path & "\db1.mdb"
Data1.RecordSource = "exam"
Data1.Refresh

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -