📄 单个查询.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.CommandButton Command1
Caption = "开始查询"
Height = 495
Left = 2280
TabIndex = 5
Top = 1080
Width = 1215
End
Begin VB.TextBox Text1
Height = 3375
Left = 480
MultiLine = -1 'True
TabIndex = 2
Top = 3600
Width = 6735
End
Begin VB.OptionButton Option2
Caption = "按教师姓名"
Height = 495
Left = 360
TabIndex = 1
Top = 1080
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "按教师序号"
Height = 495
Left = 360
TabIndex = 0
Top = 360
Width = 1215
End
Begin VB.Label Label2
Caption = "序号 姓名 入校时间 赡养人数 原工资 更改工资"
Height = 495
Left = 480
TabIndex = 4
Top = 3000
Width = 6735
End
Begin VB.Label Label1
Caption = "查询结果"
Height = 495
Left = 480
TabIndex = 3
Top = 2280
Width = 1215
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim op As Integer
Public SelectString As String
Private Sub Command1_Click()
'Dim selectstring As String
Dim SelectName As String
Dim SelectIndex As Integer
If ResClose = 1 Then
RES.Open
ResClose = 0
ResOpen = 1
End If
If op = 1 Then
SelectString = (InputBox("输入你要查询的教师序号")) '提示输入
If SelectString <> "" And IsNumeric(SelectString) Then '输入有效
SelectIndex = Int(SelectString) '
If ResClose = 1 Then '若游标关闭,则打开它
RES.ActiveConnection = Comsalary
RES.Open
ResOpen = 1
ResClose = 0
End If
Me.Text1.Locked = False
Me.Text1.Text = ""
RES.MoveFirst
While Not RES.EOF
If RES.Fields(0) = SelectIndex Then
For i = 0 To RES.Fields.Count - 1
Me.Text1.Text = Me.Text1.Text & " " & RES.Fields(i)
Next
End If
RES.MoveNext
Wend
Else:
End If
ElseIf op = 2 Then
'用姓名查询
'SelectName = InputBox("输入你要查询的教师姓名")
Form3.show
SelectName = SelectString
If ResOpen = 0 Then '若游标关闭,则打开它
RES.ActiveConnection = Comsalary
RES.Open
RES.MoveFirst
While Not RES.EOF
If SelectName = Trim(RES.Fields("姓名")) Then
Me.Text1.Text = ""
For i = 0 To RES.Fields.Count - 1
Me.Text1.Text = Me.Text1.Text & " " & RES.Fields(i)
Next
End If
RES.MoveNext
Wend
End If
Me.Text1.Locked = True
End If
'游标仍打开
ResOpen = 1
ResClose = 0
End Sub
Private Sub Form_load()
If ResOpen = 1 Then
RES.Close
ResOpen = 0 '窗体加载时,游标关闭
ResClose = 1
End If
End Sub
Private Sub Option1_Click()
op = 1
End Sub
Private Sub Option2_Click()
op = 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -