?? 添加課程信息.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 + -