📄 form_teacher.frm
字号:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 6720
Top = 5400
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 873
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 = 0
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
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.ComboBox Combo2
Height = 300
Left = 7200
TabIndex = 6
Top = 240
Width = 735
End
Begin VB.TextBox Text1
Height = 300
Left = 4200
TabIndex = 2
Top = 240
Width = 1815
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1200
TabIndex = 0
Top = 240
Width = 1935
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "性别:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000040C0&
Height = 255
Left = 6360
TabIndex = 4
Top = 240
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "姓名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000040C0&
Height = 375
Left = 3240
TabIndex = 3
Top = 240
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "教师号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000040C0&
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 1095
End
End
Attribute VB_Name = "Form_teacher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from teacher where 教师号='" & Combo1.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
Text1.Text = !姓名
Combo2.Text = !性别
End With
End Sub
Private Sub Command1_Click()
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from teacher where 教师号 = '" & Combo1.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
If .EOF Or .BOF Then
MsgBox "本校没有这个老师!", vbOKOnly + vbExclamation, "对不起!"
Else
.MoveNext
Adodc2.ConnectionString = Connection
Adodc2.RecordSource = "select * from classroomtime where 教师号='" & Combo1.Text & "'"
Adodc2.Refresh
With Adodc2.Recordset
If .EOF Or .BOF Then
MsgBox "这个老师暂未安排课程!", vbOKOnly + vbExclamation, "对不起!"
Else
.MoveNext
End If
End With
End If
End With
End Sub
Private Sub Command2_Click()
If Combo1.Text <> "" And Combo2.Text <> "" And Text1.Text <> "" Then
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from teacher where 教师号='" & Combo1.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
If .EOF Then
.AddNew
!教师号 = Combo1.Text
!姓名 = Text1.Text
!性别 = Combo2.Text
.Update
.MoveNext
Else
.MoveNext
MsgBox "这个老师已在本校!", vbOKOnly + vbExclamation, "对不起!"
End If
End With
Else
MsgBox "每个空都要添的!", vbOKOnly + vbExclamation, "对不起!"
End If
End Sub
Private Sub Command3_Click()
Combo1.Clear
Combo2.Clear
Text1.Text = ""
With Adodc1.Recordset
If .EOF Or .BOF Then
MsgBox "请选择删除的记录!", vbOKOnly + vbExclamation, "警告!"
Else
.Delete
.MoveNext
End If
End With
End Sub
Private Sub Command4_Click()
Combo2.Clear
With Combo2
.AddItem "女"
.AddItem "男"
End With
Combo1.Clear
Text1.Text = ""
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from teacher order by 教师号"
Adodc1.Refresh
With Adodc1.Recordset
While Not .EOF And Not .BOF
Combo1.AddItem !教师号
.MoveNext
Wend
End With
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select * from teacher order by 教师号"
Adodc1.Refresh
With Adodc1.Recordset
While Not .EOF And Not .BOF
Combo1.AddItem !教师号
.MoveNext
Wend
End With
With Combo2
.AddItem "女"
.AddItem "男"
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -