📄 cjxg.frm
字号:
VERSION 5.00
Begin VB.Form 成绩修改
Caption = "成绩管理-成绩修改"
ClientHeight = 2805
ClientLeft = 60
ClientTop = 450
ClientWidth = 4710
LinkTopic = "Form17"
ScaleHeight = 2805
ScaleWidth = 4710
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "输入修改信息"
Height = 1005
Left = 30
TabIndex = 7
Top = 1740
Width = 4635
Begin VB.CommandButton Command3
Caption = "修改"
Height = 315
Left = 3840
TabIndex = 12
Top = 630
Width = 735
End
Begin VB.TextBox Text3
Height = 285
Left = 3000
TabIndex = 11
Text = "Text3"
Top = 270
Width = 1185
End
Begin VB.TextBox Text2
Height = 285
Left = 810
TabIndex = 9
Text = "Text2"
Top = 270
Width = 1095
End
Begin VB.Label Label6
Caption = "新成绩"
Height = 195
Left = 2340
TabIndex = 10
Top = 330
Width = 675
End
Begin VB.Label Label5
Caption = "原成绩"
Height = 225
Left = 150
TabIndex = 8
Top = 330
Width = 615
End
End
Begin VB.Frame Frame1
Caption = "输入查找信息"
Height = 1185
Left = 30
TabIndex = 1
Top = 510
Width = 4665
Begin VB.ComboBox Combo2
Height = 300
Left = 1020
Style = 2 'Dropdown List
TabIndex = 13
Top = 780
Width = 1965
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 285
Left = 3780
TabIndex = 6
Top = 300
Width = 735
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 285
Left = 2910
TabIndex = 5
Top = 300
Width = 675
End
Begin VB.ComboBox Combo1
Height = 300
Left = 780
Style = 2 'Dropdown List
TabIndex = 4
Top = 300
Width = 1995
End
Begin VB.Label Label3
Caption = "课程名称"
Height = 285
Left = 120
TabIndex = 3
Top = 810
Width = 945
End
Begin VB.Label Label2
Caption = "学号"
Height = 225
Left = 150
TabIndex = 2
Top = 330
Width = 435
End
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "成 绩 修 改"
BeginProperty Font
Name = "黑体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 30
TabIndex = 0
Top = 30
Width = 4635
End
End
Attribute VB_Name = "成绩修改"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
'Dim mrc1 As ADODB.Recordset
Dim kch As String
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox " 请选择学号!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox " 请选择课程名称!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
txtsql = "select * from 课程 where 课程名称='" & Trim(Combo2.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
kch = mrc.Fields(0)
mrc.Close
txtsql = "select * from 学生成绩 where 学号='" & Trim(Combo1.Text) & "' and 课程号='" & Trim(kch) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 该学生的此课程不存在!", vbExclamation + vbOKOnly, "警告"
mrc.Close
Exit Sub
End If
Text2.Text = Str$(mrc.Fields(5))
Command3.Enabled = True
Text3.Enabled = True
Text3.SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
If Text3.Text = "" Then
MsgBox " 请输入修改成绩!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
mrc.Fields(5) = Val(Text3.Text)
mrc.Update
mrc.Close
MsgBox " 修改成绩成功!", vbExclamation + vbOKOnly, "警告"
Text2.Text = ""
Text3.Text = ""
Text2.Enabled = False
Text3.Enabled = False
Command3.Enabled = False
End Sub
Private Sub Form_Load()
Text2.Text = ""
Text3.Text = ""
Command3.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
txtsql = "select distinct 学号 from 学生成绩"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 学生成绩表中无记录!", vbExclamation + vbOKOnly, "警告"
mrc.Close
Exit Sub
End If
Do While Not mrc.EOF
Combo1.AddItem mrc.Fields(0)
mrc.MoveNext
Loop
txtsql = "select * from 课程"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 课程表中无记录!", vbExclamation + vbOKOnly, "警告"
mrc.Close
Exit Sub
End If
Do While Not mrc.EOF
Combo2.AddItem mrc.Fields(1)
mrc.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -