📄 bjsc.frm
字号:
VERSION 5.00
Begin VB.Form 班级删除
Caption = "班级管理-班级删除"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form8"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 2895
Left = 23
TabIndex = 0
Top = 98
Width = 4635
Begin VB.CommandButton Command2
Caption = "取消"
Height = 315
Left = 2640
TabIndex = 7
Top = 2220
Width = 915
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 315
Left = 1020
TabIndex = 6
Top = 2220
Width = 915
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1740
Style = 2 'Dropdown List
TabIndex = 5
Top = 1380
Width = 1935
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1740
Style = 2 'Dropdown List
TabIndex = 3
Top = 720
Width = 1935
End
Begin VB.Label Label3
Caption = "院系"
Height = 315
Left = 600
TabIndex = 4
Top = 780
Width = 735
End
Begin VB.Label Label2
Caption = "班级"
Height = 315
Left = 600
TabIndex = 2
Top = 1440
Width = 795
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 = 60
TabIndex = 1
Top = 120
Width = 4455
End
End
End
Attribute VB_Name = "班级删除"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim yxdm As String
Dim bjdm As String
Dim bla As String
Dim bjbl As String
Dim cjbl As String
Dim mrc1 As ADODB.Recordset
bla = "0"
bkbl = "0"
cjbl = "0"
txtsql = "select * from 院系 where 院系名称='" & Trim(Combo1.Text) & "'"
Set mrc1 = ExecuteSQL(txtsql)
'If mrc1.EOF = False Then
yxdm = mrc1.Fields(0)
'bla = "1"
mrc1.Close
'End If
txtsql = "select * from 班级 where 班级名称='" & Trim(Combo2.Text) & "'"
Set mrc1 = ExecuteSQL(txtsql)
bjdm = mrc1.Fields(0)
mrc1.Close
txtsql = "select * from 班级 where 班级名称='" & Trim(Combo2.Text) & "' and 院系代码='" & Trim(yxdm) & "'"
Set mrc1 = ExecuteSQL(txtsql)
If mrc1.EOF = False Then
bla = "1"
mrc1.Close
Else
MsgBox " 班级、院系不匹配,无法删除!", vbExclamation + vbOKOnly, "提示"
Exit Sub
End If
txtsql = "select * from 学生基本信息 where 班级代码='" & Trim(bjdm) & "'"
Set mrc1 = ExecuteSQL(txtsql)
If mrc1.EOF = False Then
bjbl = "1"
mrc1.Close
End If
txtsql = "select * from 学生成绩 where 班级代码='" & Trim(bjdm) & "'"
Set mrc1 = ExecuteSQL(txtsql)
If mrc1.EOF = False Then
cjbl = "1"
mrc1.Close
End If
If bla = "1" Then
If bjbl = "1" Then
txtsql = "select from 学生基本信息 where 班级代码='" & Trim(bjdm) & "'"
Set mrc1 = ExecuteSQL(txtsql)
If Not mrc1.EOF Then
mrc1.Delete
End If
mrc1.Close
End If
If cjbl = "1" Then
txtsql = "select from 学生成绩 where 班级代码='" & Trim(bjdm) & "'"
Set mrc1 = ExecuteSQL(txtsql)
If Not mrc1.EOF Then
mrc1.Delete
End If
mrc1.Close
End If
txtsql = "delete from 班级 where 院系代码='" & Trim(yxdm) & "' and 班级代码='" & Trim(bjdm) & "'"
Set mrc1 = ExecuteSQL(txtsql)
MsgBox " 班级删除成功!", vbExclamation + vbOKOnly, "提示"
End If
'Me.Refresh
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset
txtsql = "select * from 院系"
Set mrc = ExecuteSQL(txtsql)
Do While Not mrc.EOF
Combo1.AddItem mrc.Fields(1)
mrc.MoveNext
Loop
mrc.Close
txtsql = "select * from 班级"
Set mrc = ExecuteSQL(txtsql)
Do While Not mrc.EOF
Combo2.AddItem mrc.Fields(1)
mrc.MoveNext
Loop
mrc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -