📄 添加课程信息.frm
字号:
VERSION 5.00
Begin VB.Form 添加课程信息
Caption = "Form1"
ClientHeight = 5115
ClientLeft = 60
ClientTop = 345
ClientWidth = 6345
LinkTopic = "Form1"
ScaleHeight = 5115
ScaleWidth = 6345
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 495
Left = 1560
TabIndex = 17
Text = " "
Top = 2400
Width = 1095
End
Begin VB.TextBox Text3
Height = 495
Left = 1560
TabIndex = 16
Text = " "
Top = 1680
Width = 975
End
Begin VB.TextBox Text2
Height = 495
Left = 1560
TabIndex = 15
Text = " "
Top = 120
Width = 1095
End
Begin VB.ComboBox Combo5
Height = 300
Left = 3360
TabIndex = 14
Text = " "
Top = 3840
Width = 2535
End
Begin VB.ComboBox Combo4
Height = 300
Left = 1440
TabIndex = 13
Text = " "
Top = 3720
Width = 1215
End
Begin VB.ComboBox Combo3
Height = 300
Left = 1440
TabIndex = 12
Text = " "
Top = 4560
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1440
TabIndex = 11
Text = " "
Top = 960
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1440
TabIndex = 10
Text = " "
Top = 3120
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 615
Left = 4680
TabIndex = 7
Top = 1560
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 615
Left = 3120
TabIndex = 6
Top = 1560
Width = 1095
End
Begin VB.Label Label3
Caption = "上课时间"
Height = 495
Left = 4080
TabIndex = 9
Top = 2880
Width = 1095
End
Begin VB.Label Label2
Caption = "系部编号"
Height = 495
Left = 120
TabIndex = 8
Top = 4440
Width = 975
End
Begin VB.Label Label1
Caption = "学时"
Height = 495
Index = 5
Left = 120
TabIndex = 5
Top = 2280
Width = 1095
End
Begin VB.Label Label1
Caption = "课程编号"
Height = 495
Index = 4
Left = 120
TabIndex = 4
Top = 120
Width = 1095
End
Begin VB.Label Label1
Caption = "任课教师"
Height = 495
Index = 3
Left = 120
TabIndex = 3
Top = 3720
Width = 1095
End
Begin VB.Label Label1
Caption = "学分"
Height = 495
Index = 2
Left = 120
TabIndex = 2
Top = 1560
Width = 1095
End
Begin VB.Label Label1
Caption = "课程名称"
Height = 495
Index = 1
Left = 120
TabIndex = 1
Top = 840
Width = 1095
End
Begin VB.Label Label1
Caption = "考试类型"
Height = 495
Index = 0
Left = 120
TabIndex = 0
Top = 3000
Width = 1095
End
End
Attribute VB_Name = "添加课程信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs116 As New ADODB.Recordset
Private Sub Combo2_Click()
Dim rs18 As New ADODB.Recordset
rs18.Open "select * from 课程信息表 where 任课教师='" + Trim(Combo2.Text) + "'", cnn, 3, 1
rs18.Find "任课教师= '" & Trim(Combo2.Text) & "'"
End Sub
Private Sub Combo3_Click()
Dim rs19 As New ADODB.Recordset
rs19.Open "select * from 系部表 where 系部编号='" + Trim(Combo3.Text) + "'", cnn, 3, 1
rs19.Find "系部编号= '" & Trim(Combo3.Text) & "'"
End Sub
Private Sub Combo4_Click()
Dim rs119 As New ADODB.Recordset
rs119.Open "select * from 课程信息表 where 课程名称='" + Trim(Combo4.Text) + "'", cnn, 3, 1
rs119.Find "课程名称= '" & Trim(Combo4.Text) & "'"
End Sub
Private Sub Combo5_Click()
Dim rs129 As New ADODB.Recordset
rs129.Open "select * from 课程信息表 where 上课时间='" + Trim(Combo5.Text) + "'", cnn, 3, 1
rs129.Find "上课时间= '" & Trim(Combo5.Text) & "'"
End Sub
Private Sub Command1_Click()
If rs116.State <> 0 Then rs116.Close
rs116.Open "select * from 课程信息表", cnn, 3, 3
If Text2 = "" Then
MsgBox "请输入课程编号!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Else
If Not IsNumeric(Val(Text2)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Else
If Not IsNumeric(Val(Text1) Or Val(Text3)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else
rs116.AddNew
rs116("课程编号") = Val(Text2)
rs116("课程名称") = Trim(Combo2.Text)
rs116("学分") = Val(Text3)
rs116("学时") = Val(Text1)
rs116("考核类型") = Trim(Combo1.Text)
rs116("任课教师") = Trim(Combo4.Text)
rs116("系部编号") = Trim(Combo3.Text)
rs116("上课时间") = Trim(Combo5.Text)
rs116.Update
rs116.Requery
MsgBox "添加成功"
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim rs15 As New Recordset
rs15.Open "select * from 系部表", cnn, 3, 3
Do While Not rs15.EOF
Combo3.AddItem rs15("系部编号")
rs15.MoveNext
Loop
rs15.Close
rs15.Open "select * from 课程信息表", cnn, 3, 3
Do While Not rs15.EOF
Combo2.AddItem rs15("课程名称")
Combo4.AddItem rs15("任课教师")
Combo5.AddItem rs15("上课时间")
rs15.MoveNext
Loop
rs15.Close
Combo1.AddItem "考试"
Combo1.AddItem "考查"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -