📄 form4.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form4
Appearance = 0 'Flat
BackColor = &H00FFC0FF&
BorderStyle = 1 'Fixed Single
Caption = "查询"
ClientHeight = 6585
ClientLeft = 45
ClientTop = 330
ClientWidth = 6525
ForeColor = &H00000000&
LinkTopic = "Form4"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6585
ScaleWidth = 6525
Begin VB.Frame Frame1
BackColor = &H00FFC0FF&
Caption = "学生档案查询"
Height = 4935
Left = 840
TabIndex = 1
Top = 1200
Width = 4815
Begin VB.ComboBox Combo2
Height = 300
Left = 1680
TabIndex = 17
Top = 2640
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 600
TabIndex = 16
Top = 4200
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 2880
TabIndex = 15
Top = 4200
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 255
Index = 1
Left = 1680
TabIndex = 14
Top = 1680
Width = 2415
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 255
Index = 2
Left = 1680
TabIndex = 13
Top = 2160
Width = 2415
End
Begin VB.TextBox Text2
Height = 270
Left = 1680
TabIndex = 12
Top = 3120
Width = 2415
End
Begin VB.TextBox Text3
Height = 270
Left = 1680
TabIndex = 11
Top = 3600
Width = 2415
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 255
Index = 0
Left = 1680
TabIndex = 10
Text = " "
Top = 1200
Width = 2415
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1560
TabIndex = 9
Top = 600
Width = 2775
End
Begin VB.Label Label15
BackColor = &H00FFC0FF&
Caption = "班级:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 8
Top = 3600
Width = 975
End
Begin VB.Label Label14
BackColor = &H00FFC0FF&
Caption = "系别:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 7
Top = 3120
Width = 975
End
Begin VB.Label Label13
BackColor = &H00FFC0FF&
Caption = "年龄"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 6
Top = 2640
Width = 975
End
Begin VB.Label Label12
BackColor = &H00FFC0FF&
Caption = "性别:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 5
Top = 2160
Width = 975
End
Begin VB.Label Label11
BackColor = &H00FFC0FF&
Caption = "姓名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 4
Top = 1680
Width = 975
End
Begin VB.Label Label10
BackColor = &H00FFC0FF&
Caption = "学号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 3
Top = 1200
Width = 975
End
Begin VB.Label Label9
BackColor = &H00FFC0FF&
Caption = "查询方式:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 240
TabIndex = 2
Top = 600
Width = 1215
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 5160
Top = 360
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "he"
Password = "he"
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label3
BackColor = &H00FFC0FF&
Caption = "学生档案查询"
BeginProperty Font
Name = "楷体_GB2312"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 615
Left = 1560
TabIndex = 0
Top = 240
Width = 3255
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Select Case Combo1.Text
Case "按学号查询"
If Trim(Text1(0).Text) = "" Then
MsgBox "学号不能为空", vbExclamation + vbOKOnly, "警告"
Text1(0).SetFocus
Exit Sub
End If
str = "student.sno='" & Trim(Text1(0).Text) & "'"
Case "按姓名查询"
If Trim(Text1(1).Text) = "" Then
MsgBox "姓名不能为空", vbExclamation + vbOKOnly, "警告"
Text1(1).SetFocus
Exit Sub
End If
str = "student.name='" & Trim(Text1(1).Text) & "'"
Case "按性别查询"
If Trim(Text1(2).Text) = "" Then
MsgBox "性别不能为空", vbExclamation + vbOKOnly, "警告"
Text1(2).SetFocus
Exit Sub
End If
str = "student.sex='" & Trim(Text1(2).Text) & "'"
Case "按年龄查询"
If Trim(Combo2.Text) = "" Then
MsgBox "年龄不能为空", vbExclamation + vbOKOnly, "警告"
Combo2.SetFocus
Exit Sub
End If
str = "student.age='" & Val(Combo2.Text) & "'"
Case "按系别查询"
If Trim(Text2.Text) = "" Then
MsgBox "系别不能为空", vbExclamation + vbOKOnly, "警告"
Text2.SetFocus
Exit Sub
End If
str = "student.dept='" & Trim(Text2.Text) & "'"
Case "按班级查询"
If Trim(Text3.Text) = "" Then
MsgBox "班级不能为空", vbExclamation + vbOKOnly, "警告"
Text3.SetFocus
Exit Sub
End If
str = "student.class='" & Trim(Text3.Text) & "'"
Case ""
MsgBox "要输入一个条件才能查询!", vbExclamation + vbOKOnly, " 警告"
Combo1.SetFocus
Exit Sub
End Select
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from student where " & str
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
MsgBox "对不起,没有此学生的档案记录!", vbOKOnly, "查询"
Form4.ZOrder (0)
Form4.Text1(0).SetFocus
Exit Sub
End If
msql = "select student.sno,student.name,student.sex,student.age,student.dept,student.class from student where " & str & "order by student.sno desc"
Form3.printstr = msql
find = True
Form3.Show
Form3.Caption = "学生档案查询结果"
Form3.showtitle
Form3.showdata
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
find = True
End Sub
Private Sub Form_Load()
With Combo1
.AddItem "按学号查询"
.AddItem "按姓名查询"
.AddItem "按性别查询"
.AddItem "按年龄查询"
.AddItem "按系别查询"
.AddItem "按班级查询"
End With
Combo2.AddItem "15"
Combo2.AddItem "16"
Combo2.AddItem "17"
Combo2.AddItem "18"
Combo2.AddItem "19"
Combo2.AddItem "20"
Combo2.AddItem "21"
Combo2.AddItem "22"
Combo2.AddItem "23"
Combo2.AddItem "24"
Combo2.AddItem "25"
Combo2.AddItem "26"
Combo2.AddItem "27"
Combo2.AddItem "28"
Combo2.AddItem "29"
Combo2.AddItem "30"
End Sub
Private Sub Form_LostFocus()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
find = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -