📄 按职称查询.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form7
BackColor = &H00FFFF00&
Caption = "Form7"
ClientHeight = 3945
ClientLeft = 60
ClientTop = 435
ClientWidth = 6450
LinkTopic = "Form7"
ScaleHeight = 3945
ScaleWidth = 6450
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "退出"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4920
TabIndex = 5
Top = 3120
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "清空"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4920
TabIndex = 4
Top = 1560
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "查询"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4920
TabIndex = 3
Top = 240
Width = 1335
End
Begin VB.TextBox Text1
Height = 495
Left = 2760
TabIndex = 1
Top = 240
Width = 1815
End
Begin MSFlexGridLib.MSFlexGrid MSG
Height = 2655
Left = 120
TabIndex = 0
Top = 1080
Width = 4575
_ExtentX = 8070
_ExtentY = 4683
_Version = 393216
End
Begin VB.Label Label1
BackColor = &H00FFFF00&
Caption = "请输入要查询的职称:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 0
TabIndex = 2
Top = 240
Width = 2655
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim connectionString As String
connectionString = "dsn=教师授课;uid=sa;pwd="
cnn.Open connectionString
Dim sqlString As String
sqlString = "select 教师号,姓名,性别,所属系别 from 教师基本信息 where 职称='" & Text1.Text & "'"
rs.Open sqlString, cnn
MSG.Clear
i = 1
MSG.Cols = 4
MSG.Rows = 1
MSG.TextMatrix(0, 0) = "教师号"
MSG.TextMatrix(0, 1) = "姓名"
MSG.TextMatrix(0, 2) = "性别"
MSG.TextMatrix(0, 3) = "所属系别"
Do While Not rs.EOF
MSG.Rows = MSG.Rows + 1
MSG.TextMatrix(i, 0) = rs.Fields(0)
MSG.TextMatrix(i, 1) = rs.Fields(1)
MSG.TextMatrix(i, 2) = rs.Fields(2)
MSG.TextMatrix(i, 3) = rs.Fields(3)
i = i + 1
rs.MoveNext
Loop
rs.Close
cnn.Close
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
Form1.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -