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

📄 frmscoi.frm

📁 学生信息管理系统的设计,包含与数据库的通信接口和密码等.
💻 FRM
📖 第 1 页 / 共 4 页
字号:
                mrc.MoveNext
            Loop
        End With
    End If
    Combo2(1).Clear
    Combo2(2).Clear
    Text2(2) = ""
End Sub

Private Sub Command4_Click()
    Dim txtSQL As String
    Text2(1) = ""
    txtSQL = "select DISTINCT score_Cla from score_Form"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        With Combo2(0)
            .Clear
            Do While Not mrc.EOF
                .AddItem Trim(mrc!score_Cla)
                mrc.MoveNext
            Loop
        End With
    End If
    Combo2(1).Clear
    Combo2(2).Clear
    Text2(2) = ""
End Sub

Private Sub Command5_Click()
    Dim j As Integer
    Dim txtSQL As String
    If Text3(0) = "" Then
        MsgBox "清选择要修改的纪录!", vbOKOnly, "提示"
        MSFlexGrid1.SetFocus
        Exit Sub
    End If
    If Text3(1) = "" Then
        MsgBox "考试期号不能为空!", vbOKOnly, "提示"
        Text3(1).SetFocus
        Exit Sub
    End If
    If Combo3(0).Text = "" Then
        MsgBox "学生班号不能为空!", vbOKOnly, "提示"
        Combo3(0).SetFocus
        Exit Sub
    End If
    If Combo3(1).Text = "" Then
        MsgBox "学生编号不能为空!", vbOKOnly, "提示"
        Combo3(1).SetFocus
        Exit Sub
    End If
    If Combo3(2).Text = "" Then
        MsgBox "考试课程不能为空!", vbOKOnly, "提示"
        Combo3(2).SetFocus
        Exit Sub
    End If
    If Text3(2) = "" Then
        MsgBox "考试分数不能为空!", vbOKOnly, "提示"
        Text3(2).SetFocus
        Exit Sub
    End If
    txtSQL = "select * from score_Form where score_NO<>'" & Trim(Text3(0)) & "' And score_Per='" & Trim(Text3(1)) & "' and score_Cla='" & Trim(Combo3(0).Text) & "' and score_Stu='" & Trim(Combo3(1).Text) & "'And score_Cou='" & Trim(Combo3(2).Text) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        MsgBox "同次同人同科只能添加一次", vbOKOnly, "警告"
        Text3(2) = ""
        Combo3(0).SetFocus
        Exit Sub
    End If
    txtSQL = "Delete from score_Form where score_NO='" & Trim(Text3(0)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    txtSQL = "select * from score_Form"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    mrc.AddNew
    mrc.Fields(0) = Trim(Text3(0))
    mrc.Fields(1) = Trim(Text3(1))
    mrc.Fields(2) = Trim(Combo3(0).Text)
    mrc.Fields(3) = Trim(Combo3(1).Text)
    mrc.Fields(4) = Trim(Combo3(2).Text)
    mrc.Fields(5) = Trim(Text3(2))
    mrc.Update
    mrc.Close
    MsgBox "考试信息修改成功!", vbOKOnly, "提示"
    j = 0
    For i = 1 To MSFlexGrid1.Rows - 1
        If MSFlexGrid1.TextMatrix(i, 0) = Text3(0) Then
            j = i
        End If
    Next
    If j <> 0 Then
        With MSFlexGrid1
            .TextMatrix(j, 0) = Trim(Text3(0))
            .TextMatrix(j, 1) = Trim(Text3(1))
            .TextMatrix(j, 2) = Trim(Combo3(0).Text)
            .TextMatrix(j, 3) = Trim(Combo3(1).Text)
            .TextMatrix(j, 4) = Trim(Combo3(2).Text)
            .TextMatrix(j, 5) = Trim(Text3(2))
        End With
    End If
    Text3(0) = ""
    Text3(1) = ""
    Combo3(0).Clear
    Combo3(1).Clear
    Combo3(2).Clear
    Text3(2) = ""
    MSFlexGrid1.TopRow = j
    j = 0
End Sub

Private Sub Command6_Click()
    Text3(0) = ""
    Text3(1) = ""
    Combo3(0).Clear
    Combo3(1).Clear
    Combo3(2).Clear
    Text3(2) = ""
End Sub

Private Sub Command7_Click()
    Dim j As Integer
    Dim txtSQL As String
    If Text4(0) = "" Then
        MsgBox "清选择要删除的纪录!", vbOKOnly, "提示"
        MSFlexGrid1.SetFocus
        Exit Sub
    End If
    txtSQL = "Delete from score_Form where score_NO='" & Trim(Text4(0)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    MsgBox "考试信息修改成功!", vbOKOnly, "提示"
    j = 0
    For i = 1 To MSFlexGrid1.Rows - 1
        If MSFlexGrid1.TextMatrix(i, 0) = Text4(0) Then
            j = i
        End If
    Next
    If j <> 0 Then
        With MSFlexGrid1
            .TextMatrix(j, 0) = "已删除"
            .TextMatrix(j, 1) = "已删除"
            .TextMatrix(j, 2) = "已删除"
            .TextMatrix(j, 3) = "已删除"
            .TextMatrix(j, 4) = "已删除"
            .TextMatrix(j, 5) = "已删除"
        End With
    End If
    Text4(0) = ""
    Text4(1) = ""
    Combo4(0).Clear
    Combo4(1).Clear
    Combo4(2).Clear
    Text4(2) = ""
End Sub

Private Sub Command8_Click()
    Text4(0) = ""
    Text4(1) = ""
    Combo4(0).Clear
    Combo4(1).Clear
    Combo4(2).Clear
    Text4(2) = ""
End Sub

Private Sub Form_Load()
    Option1(1).Value = True
    Picture1(0).Visible = False
    Picture1(1).Visible = True
    Picture1(2).Visible = False
    Picture1(3).Visible = False
    Picture1(1).Top = Picture1(0).Top
    Picture1(1).Left = Picture1(0).Left
    Picture1(2).Top = Picture1(0).Top
    Picture1(2).Left = Picture1(0).Left
    Picture1(3).Top = Picture1(0).Top
    Picture1(3).Left = Picture1(0).Left
    With MSFlexGrid1
        .Cols = 6
        .TextMatrix(0, 1) = "考试期号"
        .TextMatrix(0, 2) = "学生班号"
        .TextMatrix(0, 3) = "学生编号"
        .TextMatrix(0, 4) = "考试课程"
        .TextMatrix(0, 5) = "考试分数"
        .ColWidth(0) = 0
        .ColWidth(1) = 1550
        .ColWidth(2) = 1550
        .ColWidth(3) = 1550
        .ColWidth(4) = 1550
        .ColWidth(5) = 1550
        .Rows = 1
    End With
    Text1(0) = GetRkno
End Sub

Private Sub Form_Resize()
    dColor.ZOrder 1
End Sub

Private Sub MSFlexGrid1_Click()
    Dim txtSQL As String
    If MSFlexGrid1.Row <> 0 Then
        Text3(0) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)
        Text3(1) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
        Combo3(0).Clear
        Combo3(0).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
        Combo3(0).ListIndex = 0
        txtSQL = "select * from class_Form"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        If mrc.EOF = False Then
            With Combo3(0)
                Do While Not mrc.EOF
                    If mrc!class_NO <> .Text Then
                        .AddItem Trim(mrc!class_NO)
                    End If
                    mrc.MoveNext
                Loop
            End With
        End If
        Combo3(1).Clear
        Combo3(1).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3)
        Combo3(1).ListIndex = 0
        Combo3(2).Clear
        Combo3(2).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4)
        Combo3(2).ListIndex = 0
        Text3(2) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5)
        Text4(0) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)
        Text4(1) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
        Combo4(0).Clear
        Combo4(0).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
        Combo4(0).ListIndex = 0
        Combo4(1).Clear
        Combo4(1).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3)
        Combo4(1).ListIndex = 0
        Combo4(2).Clear
        Combo4(2).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4)
        Combo4(2).ListIndex = 0
        Text4(2) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5)
    End If
End Sub

Private Sub Option1_Click(Index As Integer)
    Dim txSQL As String
    Me.Caption = "成绩信息->"
    Me.Caption = Me.Caption & Option1(Index).Caption
    Option1(0).BackColor = &HC0C0C0
    Option1(1).BackColor = &HC0C0C0
    Option1(2).BackColor = &HC0C0C0
    Option1(3).BackColor = &HC0C0C0
    Option1(Index).BackColor = &H80000005
    Picture1(0).Visible = False
    Picture1(1).Visible = False
    Picture1(2).Visible = False
    Picture1(3).Visible = False
    Picture1(Index).Visible = True
    
    txSQL = "select * from class_Form"
    Set mrc = ExecuteSQL(txSQL, MsgText)
    If mrc.EOF = True Then
        MsgBox "请先进行班级设置!", vbOKOnly, "提示"
    Else
        With Combo1(0)
            .Clear
            Do While Not mrc.EOF
                .AddItem Trim(mrc!class_NO)
                mrc.MoveNext
            Loop
        End With
    End If
    txSQL = "select DISTINCT score_Cla from score_Form"
    Set mrc = ExecuteSQL(txSQL, MsgText)
    If mrc.EOF = False Then
        With Combo2(0)
            .Clear
            Do While Not mrc.EOF
                .AddItem Trim(mrc!score_Cla)
                mrc.MoveNext
            Loop
        End With
    End If
    Text3(0) = ""
    Text3(1) = ""
    Combo3(0).Clear
    Combo3(1).Clear
    Combo3(2).Clear
    Text3(2) = ""
    Text4(0) = ""
    Text4(1) = ""
    Combo4(0).Clear
    Combo4(1).Clear
    Combo4(2).Clear
    Text4(2) = ""
End Sub
Private Function GetRkno() As String
    GetRkno = Format(Now, "yymmddhhmmss")
    Randomize
    GetRkno = GetRkno & Int((99 - 10 + 1) * Rnd + 10)
End Function

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
    If Index = 2 Then
        If KeyAscii = 190 Then
            If InStr(Trim(Text1(Index)), ".") = 0 Then
                If Len(Trim(Text1(Index))) > 0 Then
                    Text1(Index).Locked = False
                Else
                    Text1(Index).Locked = True
                End If
            Else
                Text1(Index).Locked = True
            End If
            Exit Sub
        End If
        If KeyAscii > 57 Or KeyAscii < 48 Then
            Text1(Index).Locked = True
        Else
            Text1(Index).Locked = False
        End If
        If KeyAscii = 8 Then
            Text1(Index).Locked = False
        End If
        If KeyAscii = 46 Then
            Text1(Index).Locked = False
        End If
    End If
End Sub

Private Sub Text3_KeyPress(Index As Integer, KeyAscii As Integer)
    If Index = 2 Then
        If KeyAscii = 190 Then
            If InStr(Trim(Text1(Index)), ".") = 0 Then
                If Len(Trim(Text1(Index))) > 0 Then
                    Text1(Index).Locked = False
                Else
                    Text1(Index).Locked = True
                End If
            Else
                Text1(Index).Locked = True
            End If
            Exit Sub
        End If
        If KeyAscii > 57 Or KeyAscii < 48 Then
            Text1(Index).Locked = True
        Else
            Text1(Index).Locked = False
        End If
        If KeyAscii = 8 Then
            Text1(Index).Locked = False
        End If
        If KeyAscii = 46 Then
            Text1(Index).Locked = False
        End If
    End If
End Sub

⌨️ 快捷键说明

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