📄 frmcj4.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmcj4
BackColor = &H00FFC0FF&
Caption = "修改成绩"
ClientHeight = 4770
ClientLeft = 60
ClientTop = 345
ClientWidth = 7230
LinkTopic = "Form6"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4770
ScaleWidth = 7230
Begin VB.CommandButton Command3
Caption = "删除"
Height = 375
Left = 5640
TabIndex = 11
Top = 2280
Width = 1095
End
Begin VB.Frame Frame2
BackColor = &H00FFC0FF&
Caption = "旧成绩信息"
Height = 2175
Left = 1800
TabIndex = 6
Top = 960
Width = 3375
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 375
Index = 3
Left = 1680
TabIndex = 8
Text = " "
Top = 480
Width = 1455
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 375
Index = 4
Left = 1680
TabIndex = 7
Top = 1200
Width = 1455
End
Begin VB.Label Label5
BackColor = &H00FFC0FF&
Caption = "课程号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 480
TabIndex = 10
Top = 1200
Width = 855
End
Begin VB.Label Label6
BackColor = &H00FFC0FF&
Caption = "学号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 480
TabIndex = 9
Top = 480
Width = 975
End
End
Begin VB.Frame Frame1
BackColor = &H00FFC0FF&
Caption = "新成绩信息"
Height = 1095
Left = 1800
TabIndex = 3
Top = 3240
Width = 3375
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 375
Index = 2
Left = 1680
TabIndex = 4
Top = 480
Width = 1455
End
Begin VB.Label Label4
BackColor = &H00FFC0FF&
Caption = "成绩:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 360
TabIndex = 5
Top = 480
Width = 975
End
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 5640
TabIndex = 2
Top = 3360
Width = 1095
End
Begin VB.CommandButton Command1
BackColor = &H00FFC0FF&
Caption = "修改"
Height = 375
Left = 5640
MaskColor = &H00FFC0FF&
TabIndex = 1
Top = 1080
Width = 1095
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 5640
Top = 120
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "he"
Password = "he"
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Image Image1
Height = 480
Left = 1320
Picture = "frmcj4.frx":0000
Top = 120
Width = 480
End
Begin VB.Label Label10
BackColor = &H00FFC0FF&
Caption = "修改成绩"
BeginProperty Font
Name = "楷体_GB2312"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 615
Left = 2520
TabIndex = 0
Top = 240
Width = 3375
End
End
Attribute VB_Name = "frmcj4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public printstr As String
Private Sub Command1_Click()
If Trim(Text1(3).Text) = "" Then
MsgBox "学号不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(3).SetFocus
Exit Sub
End If
If Trim(Text1(4).Text) = "" Then
MsgBox "课程号不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(4).SetFocus
Exit Sub
End If
If Trim(Text1(2).Text) = "" Then
MsgBox "成绩不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(2).SetFocus
Exit Sub
End If
sql = "select * from choose where sno='" & Trim(Text1(3).Text) & "'"
If MsgBox("确定要修改吗?", vbExclamation + vbOKCancel, "警告") = vbOK Then
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
MsgBox " 不存在学号为" & Trim(Text1(3).Text) & "的学生所选的课程号为" & Trim(Text1(4).Text) & "的成绩!", vbExclamation + vbOKOnly, "警告"
Text1(3).SetFocus
Exit Sub
End If
Adodc1.Recordset.Delete
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("sno").Value = Trim(Text1(3).Text)
Adodc1.Recordset.Fields("cno").Value = Trim(Text1(4).Text)
Adodc1.Recordset.Fields("grade").Value = Val(Text1(2).Text)
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox " 修改成功!", vbExclamation + vbOKOnly, "警告"
Text1(2).Text = ""
Text1(3).Text = ""
Text1(4).Text = ""
End If
Text1(3).Text = ""
Text1(4).Text = ""
Text1(2).Text = ""
frmcj1.printstr = sql
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
If Trim(Text1(3).Text) = "" Then
MsgBox "学号不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(3).SetFocus
Exit Sub
End If
If Trim(Text1(4).Text) = "" Then
MsgBox "课程号不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(4).SetFocus
Exit Sub
End If
If MsgBox("确定要删除吗?", vbExclamation + vbOKCancel, "警告") = vbOK Then
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from choose where sno='" & Trim(Text1(3).Text) & "' and cno='" & Trim(Text1(4).Text) & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
MsgBox " 不存在学号为" & Trim(Text1(3).Text) & "的学生所选的课程号为" & Trim(Text1(4).Text) & "的成绩!", vbExclamation + vbOKOnly, "警告"
Text1(3).SetFocus
Exit Sub
End If
Adodc1.Recordset.Delete
Adodc1.Refresh
MsgBox " 删除成功!", vbExclamation + vbOKOnly, "警告"
Text1(2).Text = ""
Text1(3).Text = ""
Text1(4).Text = ""
End If
Text1(2).Text = ""
Text1(3).Text = ""
Text1(4).Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -