📄 b学生查询.frm
字号:
VERSION 5.00
Begin VB.Form B学生查询
Caption = "学生查询"
ClientHeight = 1890
ClientLeft = 60
ClientTop = 345
ClientWidth = 7350
LinkTopic = "Form1"
ScaleHeight = 1890
ScaleWidth = 7350
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame2
Caption = "操作"
Height = 1695
Left = 3600
TabIndex = 7
Top = 120
Width = 3735
Begin VB.CommandButton CmdOpertion
Caption = "成员信息"
Height = 375
Index = 3
Left = 1220
TabIndex = 14
Top = 720
Width = 1095
End
Begin VB.CommandButton CmdOpertion
Caption = "学籍报告"
Height = 375
Index = 5
Left = 1220
TabIndex = 13
Top = 1200
Width = 1095
End
Begin VB.CommandButton CmdOpertion
Caption = "学籍异动"
Height = 375
Index = 4
Left = 120
TabIndex = 12
Top = 1200
Width = 1095
End
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 375
Left = 2640
TabIndex = 11
Top = 1200
Width = 975
End
Begin VB.CommandButton CmdOpertion
Caption = "基本信息"
Height = 375
Index = 2
Left = 120
TabIndex = 10
Top = 720
Width = 1095
End
Begin VB.CommandButton CmdOpertion
Caption = "学期注册"
Height = 375
Index = 1
Left = 1220
TabIndex = 9
Top = 240
Width = 1095
End
Begin VB.CommandButton CmdOpertion
Caption = "新生注册"
Height = 375
Index = 0
Left = 120
TabIndex = 8
Top = 240
Width = 1095
End
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 1695
Index = 0
Left = 120
TabIndex = 0
Top = 120
Width = 3375
Begin VB.ComboBox CboQuery
Height = 315
Index = 1
Left = 960
TabIndex = 3
Top = 840
Width = 2295
End
Begin VB.ComboBox CboQuery
Height = 315
Index = 0
Left = 960
TabIndex = 2
Top = 360
Width = 2295
End
Begin VB.ComboBox CboQuery
Height = 315
Index = 2
Left = 960
TabIndex = 1
Top = 1320
Width = 2295
End
Begin VB.Label Label9
Caption = "系:"
Height = 240
Left = 480
TabIndex = 6
Top = 840
Width = 735
End
Begin VB.Label Label8
Caption = "学院:"
Height = 255
Index = 0
Left = 360
TabIndex = 5
Top = 360
Width = 735
End
Begin VB.Label Label1
Caption = "班级:"
Height = 255
Left = 360
TabIndex = 4
Top = 1320
Width = 735
End
End
End
Attribute VB_Name = "B学生查询"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SQL As String
Dim msg As String
Public strQuery As String
Private Sub SelectData(Index As Integer)
Dim rst As ADODB.Recordset
Dim strItem As String
'初始化系ComboBox
If Index = 0 Then '如果是选择院
SQL = " select 系代码,系名称 from 系信息表 where 院代码='"
SQL = SQL & Left(Trim(CboQuery(0).Text), 2) & "' order by 系代码"
Set rst = SelectSQL(SQL, msg)
CboQuery(1).Clear
If rst.RecordCount > 0 Then
Do While Not rst.EOF
strItem = rst.Fields(0) & " " & rst.Fields(1)
CboQuery(1).AddItem (strItem)
rst.MoveNext
Loop
rst.Close
CboQuery(1).ListIndex = 0
Else
Exit Sub
End If
ElseIf Index = 1 Then '如果是选择系
SQL = " select 班号,班级名称 from 班级信息表 where 系代码='"
SQL = SQL & Left(Trim(CboQuery(1).Text), 4) & "' order by 班号"
Set rst = SelectSQL(SQL, msg)
CboQuery(2).Clear
If rst.RecordCount > 0 Then
Do While Not rst.EOF
strItem = rst.Fields(0) & " " & rst.Fields(1)
CboQuery(2).AddItem (strItem)
rst.MoveNext
Loop
rst.Close
CboQuery(2).ListIndex = 0
Else
Exit Sub
End If
End If
End Sub
Private Sub CboQuery_Click(Index As Integer)
If Index = 0 Then
Call SelectData(0) '得到系列表
ElseIf Index = 1 Then
If CboQuery(1).ListCount > 0 Then
Call SelectData(1) '得到班级列表
End If
End If
End Sub
Private Sub CmdExit_Click()
'退出操作
Unload Me
学生档案管理.Enabled = True
End Sub
Private Sub CmdOpertion_Click(Index As Integer)
If CboQuery(2).ListCount > 0 Then
strQuery = Left(Trim(CboQuery(2).Text), 6)
Select Case Index
Case 0 '新生注册
B基本信息.Show
B学生查询.Enabled = False
Case 1 '学期注册
B学期注册.Show
B学生查询.Enabled = False
Case 2 '基本信息
B基本信息.Show
B学生查询.Enabled = False
Case 3 '成员信息
B家庭成员信息.Show
B学生查询.Enabled = False
Case 4 '学籍异动
B学籍异动.Show
B学生查询.Enabled = False
Case 5 '学籍报告
B学籍报告.Show
B学生查询.Enabled = False
End Select
Else
MsgBox ("没有班级信息!")
End If
End Sub
Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim strItem As String
'确定按钮操作
For Index = 0 To 5
CmdOpertion(Index).Enabled = False
Next Index
If MenuIndex = 0 Then
CmdOpertion(0).Enabled = True
CmdOpertion(1).Enabled = True
Else
CmdOpertion(MenuIndex).Enabled = True
End If
'初始化ComboBox
SQL = " select 院代码,院名称 from 院信息表 order by 院代码"
Set rst = SelectSQL(SQL, msg)
If rst.RecordCount > 0 Then
Do While Not rst.EOF
strItem = rst.Fields(0) & " " & rst.Fields(1)
CboQuery(0).AddItem (strItem)
rst.MoveNext
Loop
rst.Close
CboQuery(0).ListIndex = 0
Else
MsgBox ("请先创建院信息!") '如果没有院信息不能使用
CboQuery(0).Enabled = False
CboQuery(1).Enabled = False
CboQuery(2).Enabled = False
Exit Sub
End If
Call SelectData(0) '得到系列表
If CboQuery(1).ListCount > 0 Then
Call SelectData(1) '得到班级列表
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
'退出操作
Unload Me
学生档案管理.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -