?? form7.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 + -