📄 修改课程信息.frm
字号:
VERSION 5.00
Begin VB.Form 课程信息
Caption = "Form3"
ClientHeight = 5175
ClientLeft = 60
ClientTop = 345
ClientWidth = 8130
LinkTopic = "Form3"
ScaleHeight = 5175
ScaleWidth = 8130
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 495
Left = 6120
TabIndex = 19
Text = " "
Top = 240
Width = 1335
End
Begin VB.TextBox Text2
Height = 495
Left = 1800
TabIndex = 18
Text = " "
Top = 2760
Width = 1455
End
Begin VB.TextBox Text1
Height = 495
Left = 1800
TabIndex = 17
Text = " "
Top = 1920
Width = 1335
End
Begin VB.ComboBox Combo5
Height = 300
Left = 6000
TabIndex = 16
Text = " "
Top = 2160
Width = 1695
End
Begin VB.ComboBox Combo4
Height = 300
Left = 1680
TabIndex = 15
Text = " "
Top = 360
Width = 1575
End
Begin VB.ComboBox Combo3
Height = 300
Left = 6240
TabIndex = 14
Text = " "
Top = 1200
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1800
TabIndex = 13
Text = " "
Top = 1080
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1800
TabIndex = 12
Text = " "
Top = 4080
Width = 1335
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 2055
Left = 3840
TabIndex = 8
Top = 3000
Width = 4095
Begin VB.CommandButton Command4
Caption = " 查询"
Height = 735
Left = 2160
TabIndex = 20
Top = 240
Width = 1695
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 735
Left = 2160
TabIndex = 11
Top = 1200
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 735
Left = 120
TabIndex = 10
Top = 1200
Width = 1575
End
Begin VB.CommandButton Command1
Caption = " 修改"
Height = 735
Left = 120
TabIndex = 9
Top = 240
Width = 1575
End
End
Begin VB.Label Label8
Caption = "上课时间"
Height = 615
Left = 3840
TabIndex = 7
Top = 1920
Width = 1695
End
Begin VB.Label Label7
Caption = "系部编号"
Height = 735
Left = 3960
TabIndex = 6
Top = 960
Width = 1455
End
Begin VB.Label Label6
Caption = "任课教师"
Height = 615
Left = 3960
TabIndex = 5
Top = 120
Width = 1455
End
Begin VB.Label Label5
Caption = "考核类型"
Height = 855
Left = 120
TabIndex = 4
Top = 3720
Width = 1215
End
Begin VB.Label Label4
Caption = "学时"
Height = 735
Left = 120
TabIndex = 3
Top = 2640
Width = 1215
End
Begin VB.Label Label3
Caption = "学分"
Height = 615
Left = 120
TabIndex = 2
Top = 1800
Width = 1095
End
Begin VB.Label Label2
Caption = "课程名称"
Height = 615
Left = 120
TabIndex = 1
Top = 960
Width = 1095
End
Begin VB.Label Label1
Caption = "课程编号"
Height = 495
Left = 240
TabIndex = 0
Top = 240
Width = 975
End
End
Attribute VB_Name = "课程信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs31 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 rs31.State <> 0 Then rs31.Close
rs31.Open "select * from 课程信息表 where 课程编号='" + Trim(Combo4.Text) + "'", cnn, 3, 3
rs31.Find "课程编号 like '" & (Combo4.Text) & "'"
If rs31.EOF Then
MsgBox "没有此记录!"
Combo4.Text = ""
Else
rs31("课程编号") = Trim(Combo4.Text)
rs31("课程名称") = Trim(Combo2.Text)
rs31("学分") = Trim(Text1)
rs31("学时") = Trim(Text2)
rs31("考核类型") = Trim(Combo1.Text)
rs31("任课教师") = Trim(Text3)
rs31("系部编号") = Trim(Combo3.Text)
rs31("上课时间") = Trim(Combo5.Text)
rs31.Update
rs31.Requery
MsgBox "更新成功!"
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Text1 = ""
Text2 = ""
Text3 = ""
Combo4.SetFocus
End If
End Sub
Private Sub Command2_Click()
If rs31.State <> 0 Then rs31.Close
rs31.Open "select * from 课程信息表 where 课程编号='" + Trim(Combo4.Text) + "'", cnn, 3, 3
rs31.Find "课程编号 like '" & (Combo4.Text) & "'"
If rs31.EOF Then
MsgBox ""
Else
rs31.Delete
rs31.Update
MsgBox "删除信息成功!"
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Text1 = ""
Text2 = ""
Text3 = ""
Combo4.SetFocus
End If
End Sub
Private Sub Command3_Click()
Me.Hide
End Sub
Private Sub Command4_Click()
If rs31.State <> 0 Then rs31.Close
rs31.Open "select* from 课程信息表", cnn, 3, 1
rs31.Find "课程编号 like '" & Combo4.Text & "'"
If rs31.EOF Then
MsgBox "没有此记录!"
Combo4.Text = ""
Exit Sub
Else
Combo4.Text = rs31("课程编号")
Combo2.Text = rs31("课程名称")
Text1 = rs31("学分")
Text2 = rs31("学时")
Combo1.Text = rs31("考核类型")
Text3 = rs31("任课教师")
Combo3.Text = rs31("系部编号")
Combo5.Text = rs31("上课时间")
End If
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 + -