📄 inquirestudinfo.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form inquireStudinfo
BorderStyle = 3 'Fixed Dialog
Caption = "查询信息"
ClientHeight = 7320
ClientLeft = 45
ClientTop = 435
ClientWidth = 11790
ForeColor = &H00FFFFFF&
Icon = "inquireStudinfo.frx":0000
LinkTopic = "Form3"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 7320
ScaleWidth = 11790
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 1095
Left = -120
TabIndex = 1
Top = 6120
Width = 14415
Begin VB.Frame Frame2
Height = 1095
Left = 0
TabIndex = 4
Top = 0
Width = 6375
Begin VB.TextBox Text3
BackColor = &H80000018&
Height = 270
Left = 3240
TabIndex = 10
Top = 720
Width = 1215
End
Begin VB.CheckBox Check3
Caption = "宿舍"
Height = 255
Left = 2280
TabIndex = 9
Top = 720
Width = 735
End
Begin VB.TextBox Text2
BackColor = &H80000018&
Height = 300
Left = 3240
MaxLength = 20
TabIndex = 8
Top = 480
Width = 1215
End
Begin VB.TextBox Text1
BackColor = &H80000018&
Height = 300
Left = 3240
MaxLength = 20
TabIndex = 7
Top = 210
Width = 1215
End
Begin VB.CheckBox Check2
Caption = "姓名"
Height = 255
Left = 2280
TabIndex = 6
Top = 480
Width = 735
End
Begin VB.CheckBox Check1
Caption = "学号"
Height = 180
Left = 2280
TabIndex = 5
Top = 240
Width = 735
End
End
Begin VB.CommandButton cmdExit
Caption = "取消"
Height = 255
Left = 9840
TabIndex = 3
Top = 480
Width = 975
End
Begin VB.CommandButton cmdInquire
Caption = "查询"
Height = 255
Left = 7680
TabIndex = 2
Top = 480
Width = 975
End
End
Begin MSFlexGridLib.MSFlexGrid myflexgrid
Height = 6135
Left = 0
TabIndex = 0
Top = 0
Width = 11895
_ExtentX = 20981
_ExtentY = 10821
_Version = 393216
Rows = 28
Cols = 13
BackColor = 16744576
ForeColor = 16777215
BackColorFixed = 16711680
BackColorSel = 16777152
AllowBigSelection= -1 'True
MergeCells = 4
AllowUserResizing= 1
Appearance = 0
End
End
Attribute VB_Name = "inquireStudinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdInquire_Click()
Dim txtSQL As String
Dim flag(3) As Boolean
Dim mrc As ADODB.Recordset
txtSQL = "select * from stud where "
If Check1.Value Then
If Trim(Text1.Text) = "" Then
sMeg = "您还没有输入学号!否则请取消这种查询方式!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
Else
flag(0) = True
txtSQL = txtSQL & "学号 = '" & Trim(Text1.Text) & "'"
End If
End If
If Check2.Value Then
If Trim(Text2.Text) = "" Then
sMeg = "您还没有输入姓名!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
Else
flag(1) = True
If flag(0) Then
txtSQL = txtSQL & "and student_Name = '" & Text2.Text & "'"
Else
txtSQL = txtSQL & "student_Name = '" & Text2.Text & "'"
End If
End If
End If
If Check3.Value Then
If Trim(Text3.Text) = "" Then
sMeg = "您还没有输入宿舍号码!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
Else
flag(2) = True
If flag(0) Or flag(1) Then
txtSQL = txtSQL & "and 宿舍号码 = '" & Text3.Text & "'"
Else
txtSQL = txtSQL & "宿舍号码 = '" & Text3.Text & "'"
End If
End If
End If
If Not (flag(0) Or flag(1) Or flag(2)) Then
txtSQL = "select * from stud "
End If
txtSQL = txtSQL & " order by 学号"
Set mrc = ExecuteSQL(txtSQL)
With myflexgrid
.Rows = 2
.CellAlignment = 4
.TextMatrix(1, 0) = "学号"
.TextMatrix(1, 1) = "姓名"
.TextMatrix(1, 2) = "性别"
.TextMatrix(1, 3) = "年级"
.TextMatrix(1, 4) = "班级"
.TextMatrix(1, 5) = "出生年月"
.TextMatrix(1, 6) = "宿舍号码"
.TextMatrix(1, 7) = "宿舍电话"
.TextMatrix(1, 8) = "家庭地址"
.TextMatrix(1, 9) = "邮政编码"
.TextMatrix(1, 10) = "家庭电话"
.TextMatrix(1, 11) = "备注"
.TextMatrix(1, 12) = "照片路径"
Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 1, 0) = mrc.Fields(0)
.TextMatrix(.Rows - 1, 1) = mrc.Fields(1)
.TextMatrix(.Rows - 1, 2) = mrc.Fields(2)
.TextMatrix(.Rows - 1, 3) = mrc.Fields(3)
.TextMatrix(.Rows - 1, 4) = mrc.Fields(4)
.TextMatrix(.Rows - 1, 5) = mrc.Fields(5)
.TextMatrix(.Rows - 1, 6) = mrc.Fields(6)
.TextMatrix(.Rows - 1, 7) = mrc.Fields(7)
.TextMatrix(.Rows - 1, 8) = mrc.Fields(8)
.TextMatrix(.Rows - 1, 9) = mrc.Fields(9)
.TextMatrix(.Rows - 1, 10) = mrc.Fields(10)
.TextMatrix(.Rows - 1, 11) = mrc.Fields(11)
.TextMatrix(.Rows - 1, 12) = mrc.Fields(12)
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
Private Sub Form_Load()
With myflexgrid
.CellAlignment = 4
.TextMatrix(1, 0) = "学号"
.TextMatrix(1, 1) = "姓名"
.TextMatrix(1, 2) = "性别"
.TextMatrix(1, 3) = "年级"
.TextMatrix(1, 4) = "班级"
.TextMatrix(1, 5) = "出生年月"
.TextMatrix(1, 6) = "宿舍号码"
.TextMatrix(1, 7) = "宿舍电话"
.TextMatrix(1, 8) = "家庭地址"
.TextMatrix(1, 9) = "邮政编码"
.TextMatrix(1, 10) = "家庭电话"
.TextMatrix(1, 11) = "备注"
.TextMatrix(1, 12) = "照片路径"
End With
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmMain.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -