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

📄 allmark.frm

📁 这是一个学生信息管理系统
💻 FRM
📖 第 1 页 / 共 4 页
字号:
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         FontColor       =   64
         Caption         =   "英语"
         MouseIcon       =   "AllMark.frx":129C
         MousePointer    =   99
      End
      Begin StoneXP.XPButton XPButton1 
         Height          =   375
         Index           =   4
         Left            =   3960
         TabIndex        =   86
         Top             =   360
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         FontColor       =   64
         Caption         =   "数学"
         MouseIcon       =   "AllMark.frx":15B6
         MousePointer    =   99
      End
      Begin StoneXP.XPButton XPButton1 
         Height          =   375
         Index           =   3
         Left            =   3000
         TabIndex        =   87
         Top             =   360
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         FontColor       =   64
         Caption         =   "语文"
         MouseIcon       =   "AllMark.frx":18D0
         MousePointer    =   99
      End
      Begin StoneXP.XPButton XPButton1 
         Height          =   375
         Index           =   2
         Left            =   2040
         TabIndex        =   88
         Top             =   360
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         FontColor       =   64
         Caption         =   "学号"
         MouseIcon       =   "AllMark.frx":1BEA
         MousePointer    =   99
      End
      Begin StoneXP.XPButton XPButton1 
         Height          =   375
         Index           =   1
         Left            =   1080
         TabIndex        =   89
         Top             =   360
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         FontColor       =   64
         Caption         =   "姓名"
         MouseIcon       =   "AllMark.frx":1F04
         MousePointer    =   99
      End
      Begin StoneXP.XPButton XPButton1 
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   90
         Top             =   360
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         FontColor       =   64
         Caption         =   "行号"
         MouseIcon       =   "AllMark.frx":221E
         MousePointer    =   99
      End
   End
   Begin VB.Label LabCur 
      AutoSize        =   -1  'True
      Caption         =   "1"
      Height          =   180
      Left            =   5640
      TabIndex        =   117
      Top             =   5400
      Width           =   90
   End
   Begin VB.Label LabAll 
      AutoSize        =   -1  'True
      Caption         =   "00"
      Height          =   180
      Left            =   4560
      TabIndex        =   116
      Top             =   5400
      Width           =   180
   End
   Begin VB.Label Tip1 
      AutoSize        =   -1  'True
      Caption         =   "温馨提示:点击""显示结果""里的按钮可按正反序排序后显示结果-----------------"
      ForeColor       =   &H00FF0000&
      Height          =   180
      Left            =   240
      TabIndex        =   115
      Top             =   480
      Width           =   6480
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "请选择你要查看的班级:"
      Height          =   180
      Left            =   960
      TabIndex        =   1
      Top             =   240
      Width           =   1980
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "共   页,当前第   页"
      ForeColor       =   &H00FF0000&
      Height          =   180
      Left            =   4320
      TabIndex        =   118
      Top             =   5400
      Width           =   1710
   End
End
Attribute VB_Name = "AllMark"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim flag(0 To 9) As Boolean
Dim curPage%
Dim totalCount%
Dim rst As New ADODB.Recordset
Dim classId%
'窗体启动时清空各文本框并锁定
Private Sub fLoad()
    Call toConnect
    Dim i%
    For i = 0 To 9
        Text1(i) = ""
        Text2(i) = ""
        Text3(i) = ""
        Text4(i) = ""
        Text5(i) = ""
        Text6(i) = ""
        Text7(i) = ""
        Text8(i) = ""
        Text9(i) = ""
        Text10(i) = ""
        Text1(i).Locked = True
        Text2(i).Locked = True
        Text3(i).Locked = True
        Text4(i).Locked = True
        Text5(i).Locked = True
        Text6(i).Locked = True
        Text7(i).Locked = True
        Text8(i).Locked = True
        Text9(i).Locked = True
        Text10(i).Locked = True
    Next i
End Sub
'显示结果
Private Sub showResult()
Dim i%
For i = 0 To 9
    If rst.EOF = False Then
        Text1(i) = i + 1 + 10 * (curPage - 1)
        Text2(i) = rst.Fields("sname")
        Text3(i) = rst.Fields("snum")
        Text4(i) = rst.Fields("chinese")
        Text5(i) = rst.Fields("math")
        Text6(i) = rst("english")
        Text7(i) = rst("wuli")
        Text8(i) = rst.Fields("huaxue")
        Text9(i) = rst("shengwu")
        Text10(i) = rst("total")
        rst.MoveNext
    End If
Next i
End Sub
'定义查询后的结果显示
Private Sub query_sql(sql1 As String)
    'rst记录集若是打开状态,则关闭
    If rst.State = adStateOpen Then
        rst.Close
    End If
    '打开新记录集
    rst.Open sql1, conn, 3, 2
    If rst.EOF = True Then
        MsgBox "数据库里没有任何员工信息的记录!", vbInformation, "提示"
        fLoad
    Else
        '因为处在第一页,没有上一页,所以上一页按钮隐藏
        XPButton11.Visible = False
        curPage = 1
        rst.AbsolutePage = curPage
        totalCount = rst.PageCount
        LabCur = curPage
        LabAll = totalCount
        Call showResult
    End If
    '设置下一页是否显示,当总页数超过一页时,它将显示,否则隐藏
    If totalCount > 1 Then
        XPButton12.Visible = True
    Else
        XPButton12.Visible = False
    End If
End Sub

Private Sub Combo1_Click()
    fLoad
    Dim rs As New ADODB.Recordset
    Dim sql1$
    Dim Text1$
    Text1 = Combo1.Text
    If Text1 = "全部班级" Then
        classId = -1
        Else
        sql1 = "select * from classInfo"
        Set rs = conn.Execute(sql1, 1, 1)
        While Not rs.EOF
            If Text1 = rs("classname") Then
                classId = rs("classid")
            End If
            rs.MoveNext
        Wend
    End If
End Sub

Private Sub Form_Load()
    '向列表框里添加班级
    Combo1.AddItem "全部班级"
    Combo1.ListIndex = 0
    Dim rs As ADODB.Recordset
    Dim sql1$
    sql1 = "select * from classinfo"
    toConnect
    Set rs = conn.Execute(sql1, 1, 1)
    While Not rs.EOF
        Combo1.AddItem rs("classname")
        rs.MoveNext
    Wend
    Call fLoad
    sql1 = "select * from score"
    '如果记录集处于打开状态,则关闭
    If rst.State = adStateOpen Then
        rst.Close
    End If
    '打开记录集
    rst.Open sql1, conn, 3, 2

    If rst.EOF = True Then
        MsgBox "数据库里没有任何学生成绩信息的记录!", vbInformation, "提示"
    Else
        '如果记录集不为空的相关分页设置
        curPage = 1
        rst.PageSize = 10
        rst.AbsolutePage = curPage
        totalCount = rst.PageCount
        LabAll = totalCount
        Call showResult
        '如果记录超过一页,则下一页按钮显示
        If totalCount > 1 Then
            XPButton12.Visible = True
        End If
    End If
End Sub



Private Sub XPButton1_Click(Index As Integer)
    flag(Index) = Not flag(Index)
    Dim txt1 As String
    Select Case Index
    Case 1:
        txt1 = "sname"
    Case 2:
        txt1 = "snum"
    Case 3:
        txt1 = "chinese"
    Case 4:
        txt1 = "math"
    Case 5:
        txt1 = "english"
    Case 6:
        txt1 = "wuli"
    Case 7:
        txt1 = "huaxue"
    Case 8:
        txt1 = "shengwu"
    Case 9:
        txt1 = "total"
    End Select
    
    Dim sql1$
    If Index <> 0 Then
    If flag(Index) = True Then
        If classId = -1 Then
            sql1 = "select * from score order by " & txt1
        Else
            sql1 = "select * from s_stu,score where snum=s_num and s_class=" & classId & " order by " & txt1
        End If
    Else
        If classId = -1 Then
            sql1 = "select * from score order by " & txt1 & " desc"
        Else
            sql1 = "select * from s_stu,score where snum=s_num and s_class=" & classId & " order by " & txt1 & " desc"
        End If
    End If
    Call query_sql(sql1)
    End If
End Sub

'上一页
Private Sub XPButton11_Click()
     '如果当前不是第一页,则定位于上一页,并显示结果
    If curPage > 1 Then
        curPage = curPage - 1
        XPButton12.Visible = True
        LabCur = curPage
        rst.AbsolutePage = curPage
        Call showResult
        '如果当前到了第一页,则 上一页 按钮隐藏
        If curPage = 1 Then
            XPButton11.Visible = False
        End If
    End If
End Sub
'下一页
Private Sub XPButton12_Click()
    '先清空所有文本框
    Call fLoad
    '如果没有到最后 一页
    If curPage < totalCount Then
        curPage = curPage + 1
        XPButton11.Visible = True
        LabCur = curPage
        rst.AbsolutePage = curPage
        Call showResult
        If curPage = totalCount Then
            XPButton12.Visible = False
        End If
    End If
End Sub

⌨️ 快捷键说明

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