📄 form1.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form1
BackColor = &H00FFFFFF&
Caption = "查询学籍信息窗体"
ClientHeight = 5505
ClientLeft = 60
ClientTop = 450
ClientWidth = 8415
LinkTopic = "Form1"
MDIChild = -1 'True
Picture = "Form1.frx":0000
ScaleHeight = 5505
ScaleWidth = 8415
WindowState = 2 'Maximized
Begin VB.Frame Frame1
BackColor = &H00E0E0E0&
Caption = "查询记录"
Height = 1335
Left = 480
TabIndex = 1
Top = 3120
Width = 6375
Begin VB.TextBox txtclassid
Height = 375
Left = 5280
TabIndex = 9
Top = 360
Width = 855
End
Begin VB.TextBox txtname
Height = 375
Left = 3240
TabIndex = 8
Top = 360
Width = 975
End
Begin VB.TextBox txtid
Height = 375
Left = 1200
TabIndex = 7
Top = 360
Width = 975
End
Begin VB.CommandButton cmdexit
BackColor = &H00C0C0C0&
Caption = "退出查询"
Height = 375
Left = 4560
Style = 1 'Graphical
TabIndex = 6
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdclear
BackColor = &H00C0C0C0&
Caption = "清 空"
Height = 375
Left = 2520
Style = 1 'Graphical
TabIndex = 5
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdinquire
BackColor = &H00C0C0C0&
Caption = "查 询"
Height = 375
Left = 480
Style = 1 'Graphical
TabIndex = 4
Top = 840
Width = 1215
End
Begin VB.CheckBox Chkclassid
BackColor = &H00E0E0E0&
Caption = "按班级"
Height = 375
Left = 4440
TabIndex = 3
Top = 360
Width = 1215
End
Begin VB.CheckBox chkname
BackColor = &H00E0E0E0&
Caption = "按姓名"
Height = 375
Left = 2280
TabIndex = 2
Top = 360
Width = 1215
End
Begin VB.CheckBox chkid
BackColor = &H00E0E0E0&
Caption = "按学号"
Height = 375
Left = 240
TabIndex = 10
Top = 360
Width = 1215
End
End
Begin MSFlexGridLib.MSFlexGrid msgflexGrid
Height = 2415
Left = 360
TabIndex = 0
Top = 240
Width = 6855
_ExtentX = 12091
_ExtentY = 4260
_Version = 393216
Rows = 78
Cols = 98
BackColor = 14737632
BackColorFixed = 12632256
End
End
Attribute VB_Name = "Form1"
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 msgtext As String
Dim dd(3) As Boolean
Dim mrc As Adodb.Recordset
msgflexGrid.Clear
txtsql = "select * from student_info where"
If chkid.Value = 1 Then
If Trim(txtid.Text = "") Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "如果按学号查询,请输入学号"
txtid.SetFocus: Exit Sub
Else
If Not IsNumeric(Trim(txtid.Text)) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "学号必须是数字型"
txtid.SetFocus: Exit Sub
End If
dd(0) = True
txtsql = txtsql & " student_id = '" & Trim(txtid.Text) & " '"
End If
End If
If chkname.Value = 1 Then
If Trim(txtname.Text = "") Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "如果按姓名查询,请输入姓名"
txtname.SetFocus: Exit Sub
Else
dd(1) = True
If dd(0) = True Then
txtsql = txtsql & "and student_name = '" & Trim(txtname.Text) & " '"
Else
txtsql = txtsql & " student_name = '" & Trim(txtname.Text) & " '"
End If
End If
End If
If Chkclassid.Value = 1 Then
If Trim(txtclassid.Text = "") Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "如果按班级查询,请输入班级"
txtclassid.SetFocus: Exit Sub
Else
dd(2) = True
If Not IsNumeric(Trim(txtclassid.Text)) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "班级必须是数字型"
txtclassid.SetFocus: Exit Sub
End If
If dd(0) = True Or dd(1) = True Then
txtsql = txtsql & "and class_no = '" & Trim(txtclassid.Text) & " '"
Else
txtsql = txtsql & " class_no = '" & Trim(txtclassid.Text) & " '"
End If
End If
End If
If Not (dd(0) Or dd(1) Or dd(2)) Then
FrmMain.StatusBarmy.Panels.Item(2).Text = "你还没有输入查询方式呢!"
txtid.SetFocus: Exit Sub
End If
txtsql = txtsql & "order by student_id"
Set mrc = executesql(txtsql, msgtext)
With msgflexGrid
.Row = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "学号"
.TextMatrix(0, 1) = "姓名"
.TextMatrix(0, 2) = "性别"
.TextMatrix(0, 3) = "出生日期"
.TextMatrix(0, 4) = "班号"
.TextMatrix(0, 5) = "联系电话"
.TextMatrix(0, 6) = "入校时间"
.TextMatrix(0, 7) = "家庭地址"
Do While Not mrc.EOF
.Row = .Row + 1
.CellAlignment = 4
.TextMatrix(.Row - 1, 0) = mrc.Fields(0)
.TextMatrix(.Row - 1, 1) = mrc.Fields(1)
.TextMatrix(.Row - 1, 2) = mrc.Fields(2)
.TextMatrix(.Row - 1, 3) = Format(mrc.Fields(3), "yyyy-mm-dd")
.TextMatrix(.Row - 1, 4) = mrc.Fields(4)
.TextMatrix(.Row - 1, 5) = mrc.Fields(5)
.TextMatrix(.Row - 1, 6) = Format(mrc.Fields(6), "yyyy-mm-dd")
.TextMatrix(.Row - 1, 7) = mrc.Fields(7)
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
Private Sub cmdexit_Click()
Me.Hide
End Sub
Private Sub cmdclear_Click()
msgflexGrid.Clear
chkid.Value = False
chkname.Value = False
Chkclassid.Value = False
txtid.Text = ""
txtname.Text = ""
txtclassid.Text = ""
End Sub
Private Sub Form_Load()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -