📄 frmkcxxgl.frm
字号:
VERSION 5.00
Begin VB.Form FrmKcxxgl
BorderStyle = 1 'Fixed Single
Caption = "课程信息管理"
ClientHeight = 2895
ClientLeft = 3510
ClientTop = 2580
ClientWidth = 5205
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2895
ScaleWidth = 5205
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo1
Height = 300
Left = 1440
TabIndex = 1
Top = 765
Width = 3255
End
Begin VB.TextBox Text1
Height = 270
Left = 1440
Locked = -1 'True
TabIndex = 0
TabStop = 0 'False
Top = 435
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "返回(&X)"
Height = 375
Left = 3600
TabIndex = 7
Top = 2160
Width = 855
End
Begin VB.CommandButton Command3
Caption = "删除(&D)"
Enabled = 0 'False
Height = 375
Left = 2595
TabIndex = 6
Top = 2160
Width = 855
End
Begin VB.CommandButton Command2
Caption = "更新(&U)"
Enabled = 0 'False
Height = 375
Left = 1605
TabIndex = 5
Top = 2160
Width = 855
End
Begin VB.CommandButton Command1
Caption = "添加(&A)"
Height = 375
Left = 600
TabIndex = 4
Top = 2160
Width = 855
End
Begin VB.Frame Frame1
Caption = "课程信息"
Height = 1815
Left = 240
TabIndex = 8
Top = 120
Width = 4695
Begin VB.ComboBox Combo3
Height = 300
Left = 1200
Style = 2 'Dropdown List
TabIndex = 3
Top = 1380
Width = 3255
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1200
Style = 2 'Dropdown List
TabIndex = 2
Top = 1020
Width = 3255
End
Begin VB.Label Label4
Caption = "专 业:"
Height = 255
Left = 240
TabIndex = 12
Top = 1440
Width = 1095
End
Begin VB.Label Label2
Caption = "系 别:"
Height = 255
Left = 240
TabIndex = 11
Top = 1080
Width = 975
End
Begin VB.Label Label1
Caption = "课程名称:"
Height = 255
Left = 240
TabIndex = 10
Top = 720
Width = 1095
End
Begin VB.Label Label3
Caption = "课程编号:"
Height = 255
Left = 240
TabIndex = 9
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "FrmKcxxgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Set objRs = objCon.Execute("Select kcbh From KCMCB Where kcmc='" & Combo1.Text & "'")
If Not objRs.EOF Then
Text1.Text = objRs("kcbh")
End If
objRs.Close
Command2.Enabled = True
Command3.Enabled = True
Command1.Enabled = False
End Sub
Private Sub Command1_Click()
Dim strExec As String
objCon.BeginTrans
strExec = "Insert Into KCMCB(kcbh,kcmc,xbbh,zybh) Values ('" & Text1.Text & "','" & Combo1.Text & "','" & fGetXbbh(Combo2.Text) & "','" & fGetZybh(Combo3.Text) & "')"
objCon.Execute (strExec)
objCon.CommitTrans
Text1.Text = Trim(Str(Val(Text1.Text) + 1))
Combo1.AddItem (Combo1.Text)
Combo1.Text = ""
Combo1.SetFocus
End Sub
Private Sub Command2_Click()
Dim strExec As String, strTmp As String
If Combo1.Text = "" Or Combo2.Text = "" Or Combo3.Text = "" Then
MsgBox "信息不全,请重新填写!", vbCritical, "错误信息"
Else
objCon.BeginTrans
strExec = "Update KCMCB Set kcmc='" & Combo1.Text & "',xbbh='" & fGetXbbh(Combo2.Text) & "',zybh='" & fGetZybh(Combo3.Text) & "' Where kcbh='" & Text1.Text & "'"
objCon.Execute (strExec)
objCon.CommitTrans
strTmp = Combo1.Text
Combo1.RemoveItem (Combo1.NewIndex)
Combo1.AddItem (strTmp)
MsgBox "数据更新成功。", , "系统信息"
Set objRs = objCon.Execute("Select count(*) As count From KCMCB")
If objRs("count") <> 0 Then
Set objRs = objCon.Execute("Select max(kcbh) As bh From KCMCB")
Text1.Text = Trim(Str(Val(objRs("bh")) + 1))
Else
Text1.Text = "0"
End If
objRs.Close
Combo1.Text = ""
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End If
End Sub
Private Sub Command3_Click()
Dim strExec As String
If MsgBox("您确实要删除当前记录吗?", vbYesNo, "系统信息") = vbYes Then
objCon.BeginTrans
strExec = "Delete * From KCMCB Where kcbh='" & Text1.Text & "'"
objCon.Execute (strExec)
objCon.CommitTrans
Combo1.RemoveItem (Combo1.ListIndex)
Set objRs = objCon.Execute("Select count(*) As count From KCMCB")
If objRs("count") <> 0 Then
Set objRs = objCon.Execute("Select max(kcbh) As bh From KCMCB")
Text1.Text = Trim(Str(Val(objRs("bh")) + 1))
Else
Text1.Text = "0"
End If
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
objRs.Close
Combo1.Text = ""
End If
End Sub
Private Sub Form_Load()
Set objRs = objCon.Execute("Select * From KCMCB")
If objRs.EOF Then
Text1.Text = "0"
Else
Do While Not objRs.EOF
Combo1.AddItem Trim((objRs("kcmc")))
objRs.MoveNext
Loop
Set objRs = objCon.Execute("Select str(max(val(kcbh))) As bh From KCMCB")
Text1.Text = Trim(Str(Val(objRs("bh")) + 1))
End If
Set objRs = objCon.Execute("Select Distinct xbmc From XBMCB")
Do While Not objRs.EOF
Combo2.AddItem Trim((objRs("xbmc")))
objRs.MoveNext
Loop
Set objRs = objCon.Execute("Select Distinct zymc From ZYMCB")
Do While Not objRs.EOF
Combo3.AddItem Trim((objRs("zymc")))
objRs.MoveNext
Loop
objRs.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
FrmMain.Enabled = True
End Sub
Private Sub Command4_Click()
Unload FrmKcxxgl
FrmMain.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -