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

📄 frmuseradd.frm

📁 员工信息管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmUserAdd 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "新增用户"
   ClientHeight    =   3315
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5145
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3315
   ScaleWidth      =   5145
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.TextBox Text1 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1440
      MaxLength       =   8
      PasswordChar    =   "*"
      TabIndex        =   12
      Top             =   1680
      Width           =   3495
   End
   Begin VB.Frame Frame1 
      Caption         =   "权限设制"
      Height          =   1095
      Left            =   5280
      TabIndex        =   8
      Top             =   240
      Visible         =   0   'False
      Width           =   2295
      Begin VB.OptionButton Option3 
         Caption         =   "读取权限"
         Height          =   180
         Left            =   360
         TabIndex        =   11
         Top             =   720
         Visible         =   0   'False
         Width           =   1575
      End
      Begin VB.OptionButton Option2 
         Caption         =   "修改权限"
         Height          =   255
         Left            =   360
         TabIndex        =   10
         Top             =   480
         Visible         =   0   'False
         Width           =   1215
      End
      Begin VB.OptionButton Option1 
         Caption         =   "无限制"
         Height          =   255
         Left            =   360
         TabIndex        =   9
         Top             =   240
         Visible         =   0   'False
         Width           =   1455
      End
   End
   Begin VB.CommandButton cmdReturn 
      Caption         =   "返 回"
      Height          =   375
      Left            =   3120
      TabIndex        =   4
      Top             =   2520
      Width           =   975
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "新 增"
      Default         =   -1  'True
      Height          =   375
      Left            =   1560
      TabIndex        =   3
      Top             =   2520
      Width           =   975
   End
   Begin VB.TextBox txtUser_id 
      Height          =   375
      Left            =   1440
      MaxLength       =   8
      TabIndex        =   0
      Top             =   720
      Width           =   3495
   End
   Begin VB.TextBox txtUser_pwd 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1440
      MaxLength       =   8
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   1200
      Width           =   3495
   End
   Begin VB.TextBox txtUser_des 
      Height          =   615
      Left            =   6120
      MaxLength       =   50
      MultiLine       =   -1  'True
      TabIndex        =   2
      Top             =   1680
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.Label lblUser_pwd 
      Caption         =   "确认密码:"
      Height          =   255
      Index           =   1
      Left            =   360
      TabIndex        =   13
      Top             =   1800
      Width           =   855
   End
   Begin VB.Label lblUser_id 
      Caption         =   "用 户 名:"
      Height          =   255
      Left            =   360
      TabIndex        =   7
      Top             =   840
      Width           =   855
   End
   Begin VB.Label lblUser_pwd 
      Caption         =   "密   码:"
      Height          =   255
      Index           =   0
      Left            =   360
      TabIndex        =   6
      Top             =   1320
      Width           =   855
   End
   Begin VB.Label lblUser_des 
      Caption         =   "描 述:"
      Height          =   255
      Left            =   5280
      TabIndex        =   5
      Top             =   1800
      Visible         =   0   'False
      Width           =   855
   End
End
Attribute VB_Name = "frmUserAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdAdd_Click()
    Dim strSql As String
    Dim rs As New ADODB.Recordset
    Dim strQx As String
        
    If Trim(txtUser_id.Text) = "" Then
         MsgBox "用户名不能为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
         txtUser_id.Text = ""
         txtUser_id.SetFocus
         Exit Sub
    End If
    
    If Trim(txtUser_pwd.Text) = "" Then
         MsgBox "密码不能为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
         txtUser_pwd.Text = ""
         txtUser_pwd.SetFocus
         Exit Sub
    End If
    
    
    
     If Trim(txtUser_pwd.Text) <> Trim(Text1.Text) Then
         MsgBox "两次输入得密码不相同,请重新输入!", vbOKOnly + vbExclamation, "警告"
         txtUser_pwd.Text = ""
         txtUser_pwd.SetFocus
         Exit Sub
    End If
    
    
    
    
    
    
    If Option1.Value Then
        strQx = "a"
    ElseIf Option2.Value Then
        strQx = "b"
    Else
        strQx = "c"
    End If
    
    strSql = "Select user_id from sysuser where user_id = '" & txtUser_id.Text & "'"
    rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
    
    If rs.EOF Then
     
        strSql = "Insert into sysuser (user_id,user_pwd,user_qx,user_des) Values ('" _
                 & txtUser_id.Text & "','" & txtUser_pwd.Text & "','" & strQx & "','" & txtUser_des.Text & " ')"
        dbConn.Execute strSql
        MsgBox "用户增加成功!", vbOKOnly + vbInformation, "提示"
        cmdReturn.SetFocus
    Else
         MsgBox "这个用户名已存在,请重新输入!", vbOKOnly + vbExclamation, "警告"
         txtUser_id.SetFocus
         SendKeys "{HOME}"
         SendKeys "+{end}"
         End If
    
    rs.Close
    Set rs = Nothing
End Sub

Private Sub cmdReturn_Click()
    Unload Me
End Sub


Private Sub Form_Load()
     Me.Icon = LoadPicture(App.Path & "\Graph07.ico")
    Option3.Value = True
End Sub

⌨️ 快捷键说明

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