📄 frmdel2.frm
字号:
VERSION 5.00
Begin VB.Form frmdel2
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "删除学生成绩"
ClientHeight = 1710
ClientLeft = 45
ClientTop = 435
ClientWidth = 3165
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1710
ScaleWidth = 3165
Begin VB.ComboBox coblesson
Height = 300
Left = 1800
TabIndex = 3
Text = "coblesson"
Top = 720
Width = 1215
End
Begin VB.TextBox txtID
Height = 330
Left = 1785
TabIndex = 2
Top = 240
Width = 1230
End
Begin VB.CommandButton CmdOK
Caption = "确认删除"
Default = -1 'True
Height = 420
Left = 240
TabIndex = 1
Top = 1200
Width = 1050
End
Begin VB.CommandButton CmdQuit
Cancel = -1 'True
Caption = "返回"
Height = 420
Left = 1905
TabIndex = 0
Top = 1200
Width = 1050
End
Begin VB.Label Label2
BackColor = &H00FFFFFF&
Caption = "请选择课程:"
Height = 240
Left = 240
TabIndex = 5
Top = 720
Width = 1185
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
Caption = "请输入学号:"
Height = 240
Left = 240
TabIndex = 4
Top = 240
Width = 1185
End
End
Attribute VB_Name = "frmdel2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private sk4 As String
Private sk5 As String
Private Sub cmdQuit_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Height = 2190
Me.Width = 3255
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2 - 800
'lesson
Set adoRS = adoCon.Execute("Select 课程名称 From Lesson Order By 课程名称")
coblesson.Clear
Do While Not adoRS.EOF
coblesson.AddItem Trim(adoRS("课程名称"))
adoRS.MoveNext
Loop
coblesson.ListIndex = 0
Me.Show
txtID.SetFocus
End Sub
Private Sub CmdOK_Click()
Dim sCon As String
If txtID.Text = "" Then
txtID.Text = "请输学号"
txtID.SelStart = 0
txtID.SelLength = Len(txtID.Text)
txtID.SetFocus
Exit Sub
End If
sCon = "select * from score where 学号='" & txtID.Text & "' and 课程='" & coblesson.Text & "'"
Set adoRS = adoCon.Execute(sCon)
If adoRS.EOF Then
MsgBox "对不起,查无此学生的" & Trim(coblesson.Text) & "成绩,请执行系统查询功能," _
& vbCrLf & vbCrLf & "确认要删除的学号或课程后再进行删除。", _
vbInformation + vbOKOnly, "系统提示"
txtID.SetFocus
txtID.SelStart = 0
txtID.SelLength = Len(txtID.Text)
Exit Sub
Else
sk4 = Trim(txtID.Text)
sk5 = Trim(coblesson.Text)
If MsgBox("学号:" & sk4 & vbCrLf & "课程名称:" & sk5 & vbCrLf & "确实要删除吗?", vbQuestion + vbYesNo, "系统提示") = vbYes Then
sCon = "delete from score where 学号='" & sk4 & "' and 课程='" & sk5 & "'"
Set adoRS = adoCon.Execute(sCon)
MsgBox "删除成功!", vbOKOnly, "系统提示"
Unload Me
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -