📄 frmsel1.frm
字号:
VERSION 5.00
Begin VB.Form frmsel1
Caption = "查询班主任信息"
ClientHeight = 6030
ClientLeft = 60
ClientTop = 345
ClientWidth = 7770
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 6030
ScaleWidth = 7770
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 4440
TabIndex = 20
Top = 4920
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 495
Left = 1920
TabIndex = 19
Top = 4920
Width = 1095
End
Begin VB.TextBox Text9
Height = 375
Left = 5520
TabIndex = 18
Top = 3720
Width = 1095
End
Begin VB.TextBox Text8
Height = 375
Left = 5520
TabIndex = 17
Top = 3000
Width = 1095
End
Begin VB.TextBox Text7
Height = 375
Left = 5520
TabIndex = 16
Top = 2280
Width = 1095
End
Begin VB.TextBox Text6
Height = 375
Left = 5520
TabIndex = 15
Top = 1560
Width = 1095
End
Begin VB.TextBox Text5
Height = 375
Left = 2640
TabIndex = 14
Top = 3720
Width = 1095
End
Begin VB.TextBox Text4
Height = 375
Left = 2640
TabIndex = 13
Top = 3000
Width = 1095
End
Begin VB.TextBox Text3
Height = 375
Left = 2640
TabIndex = 12
Top = 2280
Width = 1095
End
Begin VB.TextBox Text2
Height = 375
Left = 2640
TabIndex = 11
Top = 1560
Width = 1095
End
Begin VB.Frame Frame1
Caption = " 查询条件(至少一个查询条件)"
Height = 735
Left = 600
TabIndex = 0
Top = 240
Width = 6375
Begin VB.TextBox Text1
Height = 375
Left = 4800
TabIndex = 2
Top = 240
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1200
TabIndex = 1
Text = "班级"
Top = 277
Width = 1215
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "班主任姓名"
Height = 180
Left = 3480
TabIndex = 22
Top = 337
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "班级"
Height = 180
Left = 480
TabIndex = 21
Top = 337
Width = 360
End
End
Begin VB.Line Line1
X1 = 600
X2 = 6960
Y1 = 4560
Y2 = 4560
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "是否为毕业班"
Height = 180
Left = 1080
TabIndex = 10
Top = 2377
Width = 1080
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "是否在职"
Height = 180
Left = 4080
TabIndex = 9
Top = 3817
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "工作年数"
Height = 180
Left = 1080
TabIndex = 8
Top = 3817
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "开始工作时间"
Height = 180
Left = 4080
TabIndex = 7
Top = 3097
Width = 1080
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "班级名称"
Height = 180
Left = 1080
TabIndex = 6
Top = 1657
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "班主任姓名"
Height = 180
Left = 4080
TabIndex = 5
Top = 2377
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "班主任电话"
Height = 180
Left = 1080
TabIndex = 4
Top = 3090
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "班级人数"
Height = 180
Left = 4080
TabIndex = 3
Top = 1657
Width = 720
End
End
Attribute VB_Name = "frmsel1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Combo1 = "班级" And Trim(Text1.Text) = "" Then
MsgBox "请输入查询条件!", vbOKOnly + vbExclamation, "错误"
Exit Sub
End If
Dim mrcc As ADODB.Recordset
Dim msgtext As String
Dim txtSQL As String
If Trim(Text1.Text) = "" And Trim(Combo1) <> "班级" Then
txtSQL = "select id,num,name1,tel,start,biyeban,nianshu,zaizhi from class,teacher where class.id='" & Trim(Combo1) & "' and teacher.class='" & Trim(Combo1) & "'"
Set mrcc = ExecuteSQL(txtSQL, msgtext)
If mrcc.EOF = False Then
Text2.Text = mrcc.Fields(0)
Text6.Text = mrcc.Fields(1)
Text7.Text = mrcc.Fields(2)
Text4.Text = mrcc.Fields(3)
Text8.Text = mrcc.Fields(4)
Text3.Text = mrcc.Fields(5)
Text5.Text = mrcc.Fields(6)
Text9.Text = mrcc.Fields(7)
Else: MsgBox "找不到符合条件的信息!", vbOKOnly + vbExclamation, "警告"
Text1.Text = ""
Combo1 = "班级"
Text2.Text = ""
Text6.Text = ""
Text7.Text = ""
Text4.Text = ""
Text8.Text = ""
Text3.Text = ""
Text5.Text = ""
Text9.Text = ""
End If
ElseIf Trim(Combo1) = "班级" And Trim(Text1.Text) <> "" Then
txtSQL = "select class,name1,tel,start,biyeban,nianshu,zaizhi from teacher where teacher.name1='" & Trim(Text1.Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, msgtext)
If mrcc.EOF = False Then
Text2.Text = mrcc.Fields(0)
' Text6.Text = mrcc.Fields(1)
Text7.Text = mrcc.Fields(1)
Text4.Text = mrcc.Fields(2)
Text8.Text = mrcc.Fields(3)
Text3.Text = mrcc.Fields(4)
Text5.Text = mrcc.Fields(5)
Text9.Text = mrcc.Fields(6)
mrcc.Close
txtSQL = "select num from class where id='" & Trim(Text2.Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, msgtext)
Text6.Text = mrcc.Fields(0)
Else: MsgBox "找不到符合条件的信息!", vbOKOnly + vbExclamation, "警告"
Text1.Text = ""
Combo1 = "班级"
Text2.Text = ""
Text6.Text = ""
Text7.Text = ""
Text4.Text = ""
Text8.Text = ""
Text3.Text = ""
Text5.Text = ""
Text9.Text = ""
End If
ElseIf Trim(Combo1) <> "班级" And Trim(Text1.Text) <> "" Then
txtSQL = "select id,num,name1,tel,start,biyeban,nianshu,zaizhi from class,teacher where "
txtSQL = txtSQL & "class.id='" & Trim(Combo1) & "' and teacher.class='" & Trim(Combo1) & "' and teacher.name1='" & Trim(Text1.Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, msgtext)
If mrcc.EOF = False Then
Text2.Text = mrcc.Fields(0)
Text6.Text = mrcc.Fields(1)
Text7.Text = mrcc.Fields(2)
Text4.Text = mrcc.Fields(3)
Text8.Text = mrcc.Fields(4)
Text3.Text = mrcc.Fields(5)
Text5.Text = mrcc.Fields(6)
Text9.Text = mrcc.Fields(7)
Else: MsgBox "找不到符合条件的信息!", vbOKOnly + vbExclamation, "警告"
Text1.Text = ""
Combo1 = "班级"
Text2.Text = ""
Text6.Text = ""
Text7.Text = ""
Text4.Text = ""
Text8.Text = ""
Text3.Text = ""
Text5.Text = ""
Text9.Text = ""
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Height = 6435
Me.Width = 7770
Dim mrcc As ADODB.Recordset
Dim msgtext As String
Dim txtSQL As String
' Combo1.Clear
txtSQL = "select id from class"
Set mrcc = ExecuteSQL(txtSQL, msgtext)
Do While Not mrcc.EOF
Combo1.AddItem mrcc.Fields(0)
mrcc.MoveNext
Loop
mrcc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -