📄 form4.frm
字号:
VERSION 5.00
Begin VB.Form Form4
BorderStyle = 3 'Fixed Dialog
Caption = "课程成绩查询"
ClientHeight = 4365
ClientLeft = 45
ClientTop = 435
ClientWidth = 9990
LinkTopic = "Form4"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4365
ScaleWidth = 9990
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Caption = "打印成绩单"
Height = 375
Left = 7560
TabIndex = 6
Top = 2280
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
Left = 8040
TabIndex = 5
Top = 960
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 8040
TabIndex = 3
Top = 360
Width = 1335
End
Begin VB.ListBox List1
Height = 3840
Left = 360
TabIndex = 2
Top = 240
Width = 6135
End
Begin VB.CommandButton Command1
Caption = "确定查询"
Height = 375
Left = 7560
TabIndex = 1
Top = 1680
Width = 1455
End
Begin VB.Label Label4
Caption = "课程名称:"
Height = 255
Left = 7080
TabIndex = 4
Top = 1080
Width = 1335
End
Begin VB.Label Label1
Caption = "课 序 号:"
Height = 255
Left = 7080
TabIndex = 0
Top = 480
Width = 1335
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim rs_test As New ADODB.Recordset
Dim sql As String
Dim s As Single
Dim a As Single
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "请先选择查询项目"
Exit Sub
End If
sql = "select * from student,choose,kecheng,teacher,lesson where kecheng.t_id=teacher.t_id and kecheng.l_id=lesson.l_id and student.s_id=choose.s_id and choose.l_id=kecheng.l_id and (choose.l_id=" & Text1.Text & " or lesson.l_name=" & "'" & Text2.Text & "'" & ")"
Call Conn
rs_test.Open sql, Module1.conn_mdb, 3, 3
rs_test.MoveFirst
Text1.Text = rs_test("l_id")
Text2.Text = rs_test("l_name")
List1.List(0) = "课程名称:" & rs_test("l_name") & " 课 序 号:" & rs_test("l_id")
List1.List(1) = "任课教师:" & rs_test("t_name") & " 学 时:" & rs_test("l_time")
List1.List(2) = "学 分:" & rs_test("l_fen")
List1.List(3) = "____________________________________________"
List1.List(4) = " 学号 | 姓名 | 性别 | 成绩 |"
While (Not rs_test.EOF)
i = i + 1 '人数
List1.List(i + 4) = rs_test("s_id") & "| " & rs_test("s_name") & "| " & rs_test("sex") & " | " & rs_test("mark") & " |"
s = s + rs_test("mark")
rs_test.MoveNext
Wend
List1.List(i + 5) = "——————————————————————"
a = s / i
List1.List(i + 6) = "选课人数:" & i & " 平 均 分:" & a
Call conclose
End Sub
Private Sub Command2_Click()
MsgBox "功能尚未实现", , "提示"
End Sub
Private Sub Text1_Click()
Text1.Text = ""
Text2.Text = ""
List1.Clear
End Sub
Private Sub Text2_Click()
Text1.Text = ""
Text2.Text = ""
List1.Clear
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -