📄 添加成绩信息.frm
字号:
VERSION 5.00
Begin VB.Form 添加成绩信息
Caption = "Form1"
ClientHeight = 4515
ClientLeft = 60
ClientTop = 345
ClientWidth = 5370
LinkTopic = "Form1"
ScaleHeight = 4515
ScaleWidth = 5370
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
Height = 300
Left = 1440
TabIndex = 9
Text = " "
Top = 1800
Width = 1455
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 3135
Left = 3000
TabIndex = 7
Top = 240
Width = 2295
Begin VB.TextBox Text3
Height = 2535
Left = 240
TabIndex = 8
Text = " "
Top = 360
Width = 1935
End
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 1560
TabIndex = 6
Top = 2760
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 240
TabIndex = 5
Top = 2760
Width = 1095
End
Begin VB.TextBox Text2
Height = 495
Left = 1680
TabIndex = 4
Text = " "
Top = 960
Width = 1095
End
Begin VB.TextBox Text1
Height = 495
Left = 1680
TabIndex = 3
Text = " "
Top = 120
Width = 1095
End
Begin VB.Label Label3
Caption = "成绩"
Height = 495
Left = 240
TabIndex = 2
Top = 840
Width = 1095
End
Begin VB.Label Label2
Caption = "课程编号"
Height = 495
Left = 120
TabIndex = 1
Top = 1680
Width = 1095
End
Begin VB.Label Label1
Caption = "学号 "
Height = 495
Left = 360
TabIndex = 0
Top = 120
Width = 1095
End
End
Attribute VB_Name = "添加成绩信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs14 As New ADODB.Recordset
Private Sub Combo1_Click()
Dim rs15 As New ADODB.Recordset
rs15.Open "select * from 课程信息表 where 课程编号='" + Trim(Combo1.Text) + "'", cnn, 3, 1
If Not rs15.EOF Then
Text3 = rs15("任课教师") + rs15("课程名称")
End If
End Sub
Private Sub Command1_Click()
rs14.AddNew
rs14("学号") = Trim(Text1)
rs14("成绩") = Trim(Text2)
rs14("课程编号") = Trim(Combo1.Text)
rs14.Update
rs14.Requery
MsgBox "添加成功!"
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Form_Load()
Dim rs15 As New Recordset
rs15.Open "select * from 课程信息表", cnn, 3, 1
Do While Not rs15.EOF
Combo1.AddItem rs15("课程编号")
rs15.MoveNext
Loop
rs15.Close
If rs14.State <> 0 Then rs4.Close
rs14.Open "select * from 成绩表", cnn, 3, 3
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
rs14.Find "学号='" + Trim(Text1) + "'"
If Not rs14.EOF() Then
Text2 = rs14("成绩")
Combo1.Text = rs14("课程编号")
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -