📄 frmzy.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frmzy
Caption = "添加或删除专业"
ClientHeight = 3600
ClientLeft = 60
ClientTop = 450
ClientWidth = 6930
LinkTopic = "Form1"
ScaleHeight = 3600
ScaleWidth = 6930
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 360
Top = 3120
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_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 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student_data\student_massage.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student_data\student_massage.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
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.CommandButton Command3
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 10
Top = 3120
Width = 1575
End
Begin VB.Frame Frame2
Caption = "删除专业"
Height = 2655
Left = 3480
TabIndex = 1
Top = 360
Width = 3255
Begin VB.CommandButton Command2
Caption = "确定删除"
Height = 375
Left = 600
TabIndex = 9
Top = 1920
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 300
Left = 240
TabIndex = 6
Text = "请选择"
Top = 720
Width = 2415
End
Begin VB.Label Label4
AutoSize = -1 'True
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 285
Left = 240
TabIndex = 8
Top = 1440
Width = 2415
End
Begin VB.Label Label3
Caption = "您要删除的专业是:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 7
Top = 1080
Width = 2415
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "选择要删除的专业"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 240
TabIndex = 5
Top = 240
Width = 2400
End
End
Begin VB.Frame Frame1
Caption = "添加专业"
Height = 2655
Left = 360
TabIndex = 0
Top = 360
Width = 3015
Begin VB.CommandButton Command1
Caption = "确定添加"
Height = 375
Left = 720
TabIndex = 4
Top = 1920
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 480
TabIndex = 2
Top = 720
Width = 2175
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "新专业名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 3
Top = 240
Width = 1500
End
End
End
Attribute VB_Name = "Frmzy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub combo()
Combo1.Clear
Combo1.Text = "请选择"
Adodc1.RecordSource = "select * from 专业 "
Adodc1.Refresh
With Adodc1.Recordset
.MoveFirst
Do While Not .EOF
Combo1.AddItem .Fields(0)
.MoveNext
Loop
End With
End Sub
Private Sub Combo1_Click()
If Combo1.Text = "请选择" Then
Label4.Caption = ""
Else
Label4.Caption = Combo1.Text
End If
End Sub
Private Sub Command1_Click()
Adodc1.RecordSource = "select * from 专业 where 专业名称='" & Text1.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
If Text1.Text = "" Then
MsgBox "请输入您要添加的专业", vbOKOnly, "提示"
Call FocusBack(Text1)
Else
If .EOF Then
.AddNew
.Fields(0).Value = Trim$(Text1.Text)
.Update
MsgBox "添加专业成功!", vbOKOnly, "添加成功"
Else
MsgBox "此专业已经存在", vbExclamation, "错误"
Call FocusBack(Text1)
Exit Sub
End If
End If
End With
Call combo
Call Combo1_Click
Text1.Text = ""
End Sub
Private Sub Command2_Click()
Dim del As Integer
Adodc1.RecordSource = "select * from 专业 where 专业名称='" & Combo1.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
If Combo1.Text = "请选择" Then
MsgBox "请选择专业", vbOKOnly, "提示"
Else
del = MsgBox("删除该专业,将会删除该专业中所有的班级" & vbCr & "你确定删除“" & Combo1.Text & "”专业吗?", vbYesNo + vbQuestion + vbDefaultButton2, "提示")
If del = 6 Then
.Delete
.Update
MsgBox "删除成功", vbOKOnly, "提示"
Call combo
Call Combo1_Click
Label4.Caption = ""
End If
End If
End With
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Call combo
End Sub
Private Sub Form_Initialize()
ChDrive App.Path
ChDir App.Path
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -