⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_bumen_add.frm

📁 前两年帮人写的毕业设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm_bumen_add 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加部门"
   ClientHeight    =   1620
   ClientLeft      =   4530
   ClientTop       =   3450
   ClientWidth     =   3255
   Icon            =   "Frm_bumen_add.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1620
   ScaleWidth      =   3255
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command2 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Left            =   1740
      TabIndex        =   3
      Top             =   960
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   960
      Width           =   915
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Left            =   1200
      TabIndex        =   1
      Top             =   300
      Width           =   1695
   End
   Begin VB.Label Label1 
      Caption         =   "部门名称"
      Height          =   255
      Left            =   180
      TabIndex        =   0
      Top             =   360
      Width           =   915
   End
End
Attribute VB_Name = "Frm_bumen_add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    On Error GoTo myerr
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Dim sql As String
    If Trim(Text1) = "" Then
        MsgBox "部门名称不能为空!", vbExclamation, "提示"
        Text1.SetFocus
        Exit Sub
    End If
    If Len(Text1) > 50 Then
        MsgBox "部门名称不能超过50个字符!", vbExclamation, "提示"
        Text1.SetFocus
        Exit Sub
    End If
    
    Set cn = GetCn
    sql = "select * from bumen where bmmc='" & Trim(Text1) & "'"
    rst.Open sql, cn, 0, 1
    If Not (rst.BOF And rst.EOF) Then
        MsgBox "该名称已存在!", vbExclamation, "提示"
        Text1.SetFocus
        rst.Close
        cn.Close
        Exit Sub
    End If
    rst.Close
    
    sql = "insert into bumen (bmmc) values ('" & Trim(Text1) & "')"
    
    cn.Execute sql
    MsgBox "保存成功!", vbExclamation, "提示"
    Unload Me
    Exit Sub
myerr:
    MsgBox Error, vbExclamation, "提示"
    
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -