📄 specialcourse.frm
字号:
VERSION 5.00
Begin VB.Form specialcourse
Caption = "某专业添加/删除课程"
ClientHeight = 2955
ClientLeft = 60
ClientTop = 420
ClientWidth = 4740
LinkTopic = "Form1"
ScaleHeight = 2955
ScaleWidth = 4740
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text5
Height = 375
Left = 1200
TabIndex = 11
Text = "Text5"
Top = 2280
Width = 1695
End
Begin VB.CommandButton Command4
Caption = "退出"
Height = 495
Left = 3240
TabIndex = 10
Top = 1920
Width = 975
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 495
Left = 3240
TabIndex = 9
Top = 1080
Width = 975
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 3240
TabIndex = 8
Top = 240
Width = 975
End
Begin VB.TextBox Text4
Height = 375
Left = 1200
TabIndex = 7
Text = "Text4"
Top = 1800
Width = 1695
End
Begin VB.TextBox Text3
Height = 375
Left = 1200
TabIndex = 6
Text = "Text3"
Top = 1320
Width = 1695
End
Begin VB.TextBox Text2
Height = 375
Left = 1200
TabIndex = 5
Text = "Text2"
Top = 840
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 1200
TabIndex = 4
Text = "Text1"
Top = 360
Width = 1695
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
Caption = "专业名称:"
Height = 375
Left = 240
TabIndex = 12
Top = 360
Width = 975
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "考核方式:"
Height = 375
Left = 120
TabIndex = 3
Top = 2280
Width = 975
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "学时数:"
Height = 375
Left = 120
TabIndex = 2
Top = 1800
Width = 975
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "选课学期"
Height = 375
Left = 0
TabIndex = 1
Top = 1320
Width = 975
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "课程号:"
Height = 375
Left = 120
TabIndex = 0
Top = 840
Width = 975
End
End
Attribute VB_Name = "specialcourse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Dim ret As ADODB.Recordset
Dim strcnn As String
Dim db As DAO.Database
Dim rec As DAO.Recordset
'添加课程
Private Sub Command1_Click()
strcnn = "User ID=Admin;Password=;Data Source=" & App.Path & "\db.mdb;Provider=Microsoft.Jet.OLEDB.3.51"
Set cnn = New ADODB.Connection
cnn.Open strcnn
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
cmd.CommandText = "insert into " & Str$(Text1.Text) & " values('" + Text2.Text + "','" + Text3.Text + "','" + Text4.Text + "','" + Text5.Text + "')"
cmd.Execute
cnn.Close
MsgBox ("添加课程成功!!")
End Sub
'删除课程
Private Sub Command2_Click()
Dim isdelete As Integer
isdelete = MsgBox("确实要删除吗?", vbExclamation + vbDefaultButton1 + vbYesNo, "提示信息")
If isdelete Then
strcnn = "User ID=Admin;Password=;Data Source=" & App.Path & "\db.mdb;Provider=Microsoft.Jet.OLEDB.3.51"
Set cnn = New ADODB.Connection
cnn.Open strcnn
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
cmd.CommandText = "delete from " & Str$(Text1.Text) & " where 课程号=val('" + Text2.Text + "')"
cmd.Execute
cnn.Close
MsgBox ("删除成功!!")
End If
End Sub
'退出
Private Sub Command4_Click()
Me.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -