📄 qudegree.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form qudegree
Caption = "查询学生成绩记录"
ClientHeight = 4980
ClientLeft = 60
ClientTop = 345
ClientWidth = 7830
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4980
ScaleWidth = 7830
StartUpPosition = 2 '屏幕中心
Begin VB.ListBox List2
Height = 4380
Left = 4770
TabIndex = 5
Top = 390
Width = 1935
End
Begin VB.ListBox List1
Height = 4380
Left = 2820
TabIndex = 4
Top = 390
Width = 1845
End
Begin VB.CommandButton retCom
Caption = "返回"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 555
Left = 6870
TabIndex = 3
Top = 3330
Width = 885
End
Begin MSComctlLib.ImageList ImageList1
Left = 6960
Top = 120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 37
ImageHeight = 23
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "qudegree.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "qudegree.frx":0A64
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TreeView1
Height = 4755
Left = 150
TabIndex = 0
Top = 90
Width = 2535
_ExtentX = 4471
_ExtentY = 8387
_Version = 393217
PathSeparator = ""
Style = 7
Appearance = 1
End
Begin VB.Label Label3
AutoSize = -1 'True
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 210
Left = 6750
TabIndex = 6
Top = 1230
Width = 135
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "课程列表"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 3210
TabIndex = 2
Top = 90
Width = 1035
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "学生成绩列表"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 4890
TabIndex = 1
Top = 90
Width = 1545
End
End
Attribute VB_Name = "qudegree"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim rst As ADODB.Recordset
Dim rst1 As ADODB.Recordset
Dim sqltxt As String
Dim pname As String '保存当前用户选择的专业
Dim cname As String '保存当前用户选择的班号
Private Sub Comm1_Click()
If List2.ListCount > 0 Then
Else
MsgBox "成绩列表为空,不能打印报表", vbOKOnly, "信息提示"
End If
End Sub
Private Sub Form_Load()
TreeView1.ImageList = ImageList1
TreeView1.LineStyle = 1
TreeView1.Style = 7
Dim n As Integer
n = 1
sqltxt = "select * from prof"
Set rs1 = exesql(sqltxt)
If rs1.RecordCount > 0 Then
rs1.MoveFirst
Do While Not rs1.EOF
TreeView1.Nodes.Add , , "K" & Trim(Str(n)), Trim(rs1.Fields("专业")), 1
sqltxt = "select 班号 from classn where 专业='" + Trim(rs1.Fields("专业")) + "' order by 班号"
Set rs2 = exesql(sqltxt)
If rs2.RecordCount > 0 Then
rs2.MoveFirst
Do While Not rs2.EOF()
TreeView1.Nodes.Add "K" & Trim(Str(n)), 4, , Trim(rs2.Fields("班号")), 2
rs2.MoveNext
Loop
End If
rs2.Close
n = n + 1
rs1.MoveNext
Loop
End If
rs1.Close
End Sub
Private Sub List1_Click()
List2.Clear
If List1.ListIndex >= 0 Then
sqltxt = "select * from degree where 班号='" + cname + "' and 课程='" + Trim(List1.Text) + "' order by 学号"
Set rst = exesql(sqltxt)
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
List2.AddItem rst.Fields("姓名") + Str(rst.Fields("分数"))
rst.MoveNext
Loop
End If
rst.Close
End If
End Sub
Private Sub TreeView1_Collapse(ByVal Node As MSComctlLib.Node)
List1.Clear
List2.Clear
Label3.Caption = ""
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If Node.Image = 2 Then '若单击的是班号项
List1.Clear
List2.Clear
cname = Trim(Node.Text)
pname = Trim(Node.Parent.Text)
Label3.Caption = "<-" + cname + "班"
sqltxt = "select * from course where 专业='" + pname + "'"
Set rst = exesql(sqltxt)
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
List1.AddItem rst.Fields("课程")
rst.MoveNext
Loop
End If
rst.Close
End If
End Sub
Private Sub retCom_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -