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

📄 form7.frm

📁 学生成绩管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form7 
   Caption         =   "Form7"
   ClientHeight    =   4155
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5910
   LinkTopic       =   "Form7"
   ScaleHeight     =   4155
   ScaleWidth      =   5910
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   375
      Left            =   4560
      TabIndex        =   4
      Top             =   600
      Width           =   975
   End
   Begin VB.TextBox CountText 
      Height          =   2055
      Left            =   240
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   3
      Top             =   1800
      Width           =   5295
   End
   Begin VB.CommandButton SortCommand 
      Caption         =   "排序"
      Height          =   375
      Left            =   4560
      TabIndex        =   2
      Top             =   120
      Width           =   975
   End
   Begin VB.TextBox CourseText 
      Height          =   615
      Left            =   1680
      TabIndex        =   1
      Top             =   240
      Width           =   2295
   End
   Begin VB.Label Label2 
      Caption         =   "数据库中存在的课程数据有:高数,英语,物理,计算机,C语言"
      Height          =   375
      Left            =   360
      TabIndex        =   5
      Top             =   1200
      Width           =   4575
   End
   Begin VB.Label Label1 
      Caption         =   "课程:"
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   855
   End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Conn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Const ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DATA.mdb;Persist Security Info=False"


Private Sub Command1_Click()
Form4.Visible = False
Form2.Visible = True
Unload Form7

End Sub

Private Sub SortCommand_Click()


  Dim ScoreCount As Integer
  Dim strSql As String
  Dim i As Integer
  Dim flag As Integer
  
  
  Dim FailName As String
 
   FailName = ""
     
   CountText.Text = ""
  
  i = 0
 
  Set Conn = New ADODB.Connection
  Set rs = New ADODB.Recordset
  StrCourse = CourseText.Text
  Conn.Open ConnStr
  strSql = "select * from 成绩表 Order by " & StrCourse & " DESC"
 
  
  flag = 0
  If StrCourse = "高数" Or StrCourse = "英语" Or StrCourse = "物理" Or StrCourse = "计算机" Or StrCourse = "C语言" Then
       flag = 1
  End If
  
  If flag = 1 Then
  
  If Conn.State = 1 Then
     
     rs.Open strSql, Conn, adOpenKeyset, adLockPessimistic
    
     
     
     While i < rs.RecordCount
       
       
       If StrCourse = "高数" Then
          
        
          
              FailName = FailName & "姓名:" & rs.Fields(2) & "   " & "分数:" & rs.Fields(3) & vbCrLf
              
           
          
           
        ElseIf StrCourse = "英语" Then
         
      
              FailName = FailName & "姓名:" & rs.Fields(2) & "   " & "分数:" & rs.Fields(4) & vbCrLf
             
           
        ElseIf StrCourse = "物理" Then
          
           
          
              FailName = FailName & "姓名:" & rs.Fields(2) & "   " & "分数:" & rs.Fields(5) & vbCrLf
          
        
        ElseIf StrCourse = "计算机" Then
          
           
          
              FailName = FailName & "姓名:" & rs.Fields(2) & "   " & "分数:" & rs.Fields(6) & vbCrLf
            
           
        Else: StrCourse = "C语言"
          
          
              FailName = FailName & "姓名:" & rs.Fields(2) & "   " & "分数:" & rs.Fields(7) & vbCrLf
                   
           
           
       End If
       
       
       
       rs.MoveNext
       
       
       i = i + 1
     Wend
    End If
     
     CountText.Text = CountText.Text & FailName & vbCrLf
     
    rs.Close
    Conn.Close
   End If
  If flag = 0 Then
  CountText.Text = "数据库中没有这个课程的成绩记录"
  End If
  
  

  



End Sub

⌨️ 快捷键说明

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