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

📄 frmadduser.frm

📁 人事管理信息系统visual basic + my sql
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAdduser 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加用户"
   ClientHeight    =   3810
   ClientLeft      =   30
   ClientTop       =   330
   ClientWidth     =   4170
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3810
   ScaleWidth      =   4170
   Begin VB.OptionButton OpManag 
      Caption         =   "管理员"
      Height          =   375
      Left            =   3000
      TabIndex        =   10
      Top             =   2160
      Width           =   1215
   End
   Begin VB.OptionButton OpComm 
      Caption         =   "一般用户"
      Height          =   255
      Left            =   1680
      TabIndex        =   9
      Top             =   2280
      Value           =   -1  'True
      Width           =   1335
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   492
      Left            =   2280
      TabIndex        =   7
      Top             =   3000
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确认"
      Height          =   492
      Left            =   720
      TabIndex        =   6
      Top             =   3000
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   2
      Left            =   1680
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   1560
      Width           =   2175
   End
   Begin VB.TextBox Text1 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   1
      Left            =   1680
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   960
      Width           =   2175
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   0
      Left            =   1680
      TabIndex        =   0
      Top             =   360
      Width           =   2175
   End
   Begin VB.Label Label4 
      Caption         =   "用户类型:"
      Height          =   375
      Left            =   240
      TabIndex        =   8
      Top             =   2280
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "请确认密码:"
      Height          =   375
      Left            =   240
      TabIndex        =   5
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "请输入密码:"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   1080
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "请输入用户名:"
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   480
      Width           =   1710
   End
End
Attribute VB_Name = "frmAdduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim txtSQL As String
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    If UserName <> "Admin" Then
    '判断用户的权限
        MsgBox "只有超级管理员才有此权限!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    End If
    
    If Trim(Text1(0).Text) = "" Then
    '判断用户名输入是否为空
        MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
        Text1(0).SetFocus
    Else
        txtSQL = "select * from Manager "
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        While (mrc.EOF = False)
            If Trim(mrc.Fields(0)) = Trim(Text1(0)) Then
            '判断是否有重复记录
                MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
                Text1(0).SetFocus
                Text1(0).Text = ""
                Text1(1).Text = ""
                Text1(2).Text = ""
                Exit Sub
            Else
                mrc.MoveNext
            End If
        Wend
    End If
    If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
    '判断两次所输入的密码是否一致
        MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
        Text1(1).SetFocus
        Text1(1).Text = ""
        Text1(2).Text = ""
        Exit Sub
    Else
        If Text1(1).Text = "" Then
        '判断密码输入是否为空
            MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
            Text1(1).SetFocus
            Text1(1).Text = ""
            Text1(2).Text = ""
        Else
            mrc.AddNew
            '添加用户
            mrc.Fields(0) = Trim(Text1(0).Text)
            mrc.Fields(1) = Trim(Text1(1).Text)
            If OpComm.Value = True Then
             mrc.Fields(2) = 0
            Else
             mrc.Fields(2) = 1
            End If
            mrc.Update
            mrc.Close
            Me.Hide
            MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户"
        End If
    End If
End Sub

⌨️ 快捷键说明

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