📄 adddept.frm
字号:
VERSION 5.00
Begin VB.Form addDept
BorderStyle = 1 'Fixed Single
Caption = "添加系别"
ClientHeight = 1860
ClientLeft = 45
ClientTop = 330
ClientWidth = 3870
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 1860
ScaleWidth = 3870
Begin VB.CommandButton Command2
Caption = "返回(&B)"
Height = 375
Left = 2400
TabIndex = 3
Top = 1320
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "保存(&S)"
Height = 375
Left = 240
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.Frame Frame1
Caption = "系别名称"
Height = 975
Left = 120
TabIndex = 0
Top = 120
Width = 3615
Begin VB.TextBox Text1
Height = 375
Left = 360
TabIndex = 1
Top = 360
Width = 2895
End
End
End
Attribute VB_Name = "addDept"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim txtSQL As String
Dim MsgText As String
Dim MRC As ADODB.Recordset
Dim insSQL As String
Dim InsText As String
Dim INS As ADODB.Recordset
Dim DeptID As Integer
If Not Testtxt(Text1) Then
MsgBox "请输入系别名称!", vbOKOnly + vbExclamation, "学籍管理系统"
Exit Sub
End If
txtSQL = "SELECT * FROM Department WHERE DeptName='" & Text1.Text & "'"
Set MRC = ExecuteSQL(txtSQL, MsgText)
If Not (MRC.EOF) Then
MsgBox "该系别名称已经写入数据库中!", vbOKOnly + vbExclamation, "成绩管理系统"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
txtSQL = "SELECT COUNT(*) FROM Department WHERE DeptID>0"
Set MRC = ExecuteSQL(txtSQL, MsgText)
If (MRC.Fields(0).Value = 0) Then
DeptID = 1
Else
DeptID = MRC.Fields(0).Value + 1
End If
insSQL = "INSERT INTO Department VALUES(" & DeptID & " ,'" & Text1.Text & "')"
Set INS = ExecuteSQL(insSQL, InsText)
Call Module1.JUDGE(InsText, addDept)
Text1.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Move (frmMain.ScaleWidth - Me.Width) / 2, (frmMain.ScaleHeight - Me.Height) / 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -