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

📄 a教师阅卷.frm

📁 在线考试系统。用vb编写
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Height          =   375
         Left            =   1440
         TabIndex        =   16
         Top             =   720
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "客观题分数:"
         Height          =   375
         Left            =   360
         TabIndex        =   15
         Top             =   840
         Width           =   1335
      End
      Begin VB.Label Label1 
         Caption         =   "选择没有批阅的考生号:"
         Height          =   255
         Index           =   1
         Left            =   3480
         TabIndex        =   3
         Top             =   360
         Width           =   2055
      End
      Begin VB.Label Label1 
         Caption         =   "选择考试:"
         Height          =   255
         Index           =   0
         Left            =   360
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "A教师阅卷"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SQL As String
Dim msg As String
Dim Index As Integer
Dim ZGTNo(1 To 5) As String                     '保存考生的5道主观题的考题号
Dim colValue As String                          '保存当前显示的考题号
Private Sub Form_Load()
    Call TextEnabled                            '控制Text的Enabled属性
    Call InitialComboBox                        '初始化考试信息和考生信息
End Sub
Private Sub TextEnabled()
'控制Text的Enabled属性
    txtQuestion.Enabled = False                 '题目不能被修改
    txtAnswer.Enabled = False                   '考生答案不能被修改
    txtSelf.Enabled = False                     '标准答案不能被修改
End Sub
Private Sub InitialComboBox()
'初始化考试信息和考生
    Dim rst As ADODB.Recordset
    
    '清空ComboBox
    CboKaoShi.Clear
    CboStu.Clear
    
    '查询考试信息
    SQL = " Select * from 考试信息表 where 考试标志='考试结束' order by 开考时间"
    Set rst = SelectSQL(SQL, msg)
    If rst.EOF = True Then
        MsgBox "现在还没有要批阅的卷子!"
    Else
        Do Until rst.EOF
            '添加到ComboBox列表
            CboKaoShi.AddItem (rst.Fields("考试代码"))
            rst.MoveNext                        '指向下一条记录
        Loop
        rst.MoveFirst
        '查询默认考试代码的考生信息
        SQL = " Select * from 成绩信息表 where "
        SQL = SQL & "考试代码='" & rst.Fields("考试代码")
        SQL = SQL & "' and 试卷状态='未阅' order by 考生号"
        Set rst = Nothing
        Set rst = SelectSQL(SQL, msg)
        If rst.EOF = True Then
            Exit Sub
        Else
            Do Until rst.EOF
                '添加到ComboBox列表
                CboStu.AddItem (rst.Fields("考生号") & rst.Fields("姓名"))
                rst.MoveNext                    '指向下一条记录
            Loop
        End If
        CboStu.listindex = 0                    '默认ComboBox
        CboKaoShi.listindex = 0                 '默认ComboBox
        rst.Close
    End If
End Sub
Private Sub CboKaoShi_Click()
'选择考场,不同考场的考生不一样
    Dim rst As ADODB.Recordset
    Dim colValue As String                      '保存考试代码
    
    '清空ComboBox
    CboStu.Clear
    colValue = Trim(CboKaoShi.Text)
    
    '查询考生信息
    SQL = " Select * from 成绩信息表 where "
    SQL = SQL & "考试代码='" & colValue & "' and 试卷状态='未阅' order by 考生号"
    Set rst = SelectSQL(SQL, msg)
    If rst.EOF = True Then
            Exit Sub
        Else
            Do Until rst.EOF
                '添加到ComboBox列表
                CboStu.AddItem (rst.Fields("考生号") & rst.Fields("姓名"))
                rst.MoveNext                    '指向下一条记录
            Loop
        End If
        CboStu.listindex = 0                    '默认ComboBox
End Sub
Private Sub CboStu_Click()
'选择考生,不同考生的考题不一样
    Dim rst As ADODB.Recordset
    
    '清空ComboBox
    CboZGT(0).Clear
    CboZGT(1).Clear
    
    '显示考生的客观题得分
    SQL = " Select * from 成绩信息表 where 考生号='" & Left(Trim(CboStu.Text), 6) & "'"
    Set rst = SelectSQL(SQL, msg)
    Label6.Caption = rst.Fields("客观题得分")
    
    Call StuRecords                             '动态显示考生主观题得分
    Call setComboZGT                            '得到主观题ComboBox中的值
End Sub
Private Sub StuRecords()
'动态显示考生主观题得分
    Dim rst As ADODB.Recordset
    '判断该考生是否进行过考试
    SQL = " Select * from 考生主观题作答表 where "
    SQL = SQL & "考生号='" & Left(Trim(CboStu.Text), 6) & "'"
    Set rst = SelectSQL(SQL, msg)
    If rst.EOF = False Then                     '如果该考生参加过考试
        SQL = "Select sum(得分) from 考生主观题作答表 where "
        SQL = SQL & "考生号='" & Left(Trim(CboStu.Text), 6) & "'"
        Set rst = SelectSQL(SQL, msg)
        Label8.Caption = rst.Fields(0)
    End If
End Sub
Private Sub setComboZGT()
'设置主观题ComboBox中的值
    Dim index1 As Integer
    Dim rst As ADODB.Recordset
    Dim str As String
    '清空ComboBox
    CboZGT(0).Clear
    CboZGT(1).Clear
    
    '把考题号保存到数组中
    SQL = " Select * from 考生主观题作答表 where 考生号='" & Left(Trim(CboStu.Text), 6)
    SQL = SQL & "' order by 考题号"
    Set rst = SelectSQL(SQL, msg)
    If rst.EOF = True Then
        MsgBox "该考生没有进行考试!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    Else
        For Index = 1 To 5
            ZGTNo(Index) = rst.Fields("考题号")
            rst.MoveNext
        Next Index
    End If
        
    '把考题号添加至ComboBox
    For Index = 1 To 5
        str = "第 " & Index & " 道题"
        SQL = " Select * from 考生主观题作答表 where 考生号='" & Left(Trim(CboStu.Text), 6)
        SQL = SQL & "' and 考题号='" & Trim(ZGTNo(Index)) & "'"
        Set rst = SelectSQL(SQL, msg)
        If rst.Fields("阅卷标志") = "否" Then   '将没有阅过的题号添加到未阅主观题
            CboZGT(0).AddItem str
        Else                                    '将阅过的题号添加到已阅主观题
            CboZGT(1).AddItem str
        End If
    Next Index
    If CboZGT(0).ListCount > 0 Then             '如果存在数据
        CboZGT(0).listindex = 0
    End If
    If CboZGT(1).ListCount > 0 Then             '如果存在数据
        CboZGT(1).listindex = 0
    End If
End Sub
Private Sub CboZGT_Click(Index As Integer)
'在控件中显示数据
    Dim rst As ADODB.Recordset
    Dim index1 As Integer
    Dim listindex As Integer
    '得到考题号
    listindex = CInt(Trim(Mid(Trim(CboZGT(Index).Text), 3, 2)))
    colValue = Trim(ZGTNo(listindex))
    '查询考题
    SQL = " Select 考题号,题目内容,答案 from 主观题信息表 "
    SQL = SQL & " where 考题号='" & colValue & "'"
    Set rst = SelectSQL(SQL, msg)
    '显示题目和标准答案
    txtQuestion.Text = rst.Fields("题目内容")
    txtSelf.Text = rst.Fields("答案")
   
    '显示考生所作答案
    SQL = " Select * from 考生主观题作答表 where 考生号='" & Left(Trim(CboStu.Text), 6) & "'"
    SQL = SQL & " and 考题号='" & colValue & "'"
    Set rst = SelectSQL(SQL, msg)
    txtAnswer.Text = rst.Fields("答案")
End Sub
Private Sub CboOk_Click()
'对每一道主观题进行评分操作

    '将评分写入考生主观题作答表
    If IsNumeric(txtRecord.Text) Then
        SQL = "Update 考生主观题作答表 set 得分='" & CDbl(txtRecord.Text) & "',阅卷标志='是'"
        SQL = SQL & " where 考生号='" & Left(Trim(CboStu.Text), 6) & "'and 考题号='" & colValue & "'"
        Call ExecuteSQL(SQL, msg)
        Call setComboZGT                        '改变主观题ComboBox中的值
        Call StuRecords                         '动态显示考生主观题得分
        txtRecord.Text = "0"
    Else
        MsgBox "请输入数字!"
        txtRecord.SetFocus
        txtRecord.SelStart = 0
        txtRecord.SelLength = Len(txtRecord.Text)
    End If
End Sub
Private Sub CmdEnd_Click()
'阅完一个考生的主观题
    Dim rst As ADODB.Recordset
    '计算一个考生的主观题总分
    SQL = "Select sum(得分) from 考生主观题作答表 where "
    SQL = SQL & "考生号='" & Left(Trim(CboStu.Text), 6) & "'"
    Set rst = SelectSQL(SQL, msg)
    '将一个考生的主观题总分、评卷教师ID、试卷状态写入成绩信息表中
    SQL = "update 成绩信息表 set 主观题得分='" & rst.Fields(0) & "',评卷教师ID='" & UserID
    SQL = SQL & "',试卷状态='已阅' where 考生号='" & Left(Trim(CboStu.Text), 6) & "'"
    Call ExecuteSQL(SQL, msg)
    MsgBox "写入成功!"
    '计算考生的总分
    SQL = " Select * from 成绩信息表 where 考生号='" & Left(Trim(CboStu.Text), 6) & "'"
    Set rst = Nothing
    Set rst = SelectSQL(SQL, msg)
    rst.Fields("总分") = CDbl(rst.Fields("客观题得分")) + CDbl(rst.Fields("主观题得分"))
    rst.Update
    CboKaoShi_Click
End Sub
Private Sub CmdExit_Click()
'退出操作
    A教师阅卷管理.Enabled = True
    Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
'退出操作
    A教师阅卷管理.Enabled = True
    Unload Me
End Sub

⌨️ 快捷键说明

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