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

📄 frmadduser.frm

📁 用VB+Access实现的企业人事工资管理系统。
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmAdduser 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加用户"
   ClientHeight    =   4425
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5115
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4425
   ScaleWidth      =   5115
   ShowInTaskbar   =   0   'False
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   2520
      Top             =   2880
      Visible         =   0   'False
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=personnel"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "personnel"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "user"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton cmdCanel 
      Caption         =   "取消"
      Height          =   495
      Left            =   2880
      TabIndex        =   5
      Top             =   3480
      Width           =   1575
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   495
      Left            =   600
      TabIndex        =   4
      Top             =   3480
      Width           =   1575
   End
   Begin VB.TextBox txtPassword2 
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   2400
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   2160
      Width           =   1695
   End
   Begin VB.TextBox txtPassword1 
      DataSource      =   "Adodc1"
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   2400
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1320
      Width           =   1695
   End
   Begin VB.TextBox txtUserName 
      Height          =   495
      Left            =   2400
      TabIndex        =   1
      Top             =   480
      Width           =   1695
   End
   Begin VB.Label l3 
      Caption         =   "请确认密码:"
      Height          =   615
      Left            =   480
      TabIndex        =   7
      Top             =   2280
      Width           =   1455
   End
   Begin VB.Label l2 
      Caption         =   "请输入密码:"
      Height          =   495
      Left            =   480
      TabIndex        =   6
      Top             =   1440
      Width           =   1695
   End
   Begin VB.Label l1 
      Caption         =   "请输入用户名:"
      Height          =   735
      Left            =   480
      TabIndex        =   0
      Top             =   600
      Width           =   2655
   End
End
Attribute VB_Name = "frmAdduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCanel_Click()
Unload Me
End Sub
'判断用户名是否已经存在
Private Function nameExist(name As String) As Boolean
Dim i As Integer
i = 0
Adodc1.Recordset.MoveFirst
While (Not Adodc1.Recordset.EOF)
    If Adodc1.Recordset("username") = name Then
        i = i + 1
    End If
    Adodc1.Recordset.MoveNext
Wend
If i = 0 Then
    nameExist = False
Else
    nameExist = True
End If
End Function

Private Sub cmdOK_Click()
'判断输入是否有效
If (txtUserName.Text <> "") And (txtPassword1 <> "") And (txtPassword2 <> "") Then
    If nameExist(txtUserName.Text) = False Then
        If txtPassword1.Text = txtPassword2.Text Then
            Adodc1.Recordset.MoveLast
            '添加记录
            Adodc1.Recordset.AddNew
            '将用户名和密码保存到记录
            Adodc1.Recordset("username") = txtUserName.Text
            Adodc1.Recordset("pwd") = txtPassword1.Text
            Adodc1.Recordset.UpdateBatch
            MsgBox "添加用户成功!", vbOKOnly + vbInformation, "提示信息"
            Unload Me
        Else
            MsgBox "两次密码不一样,请确认!", vbOKOnly + vbExclamation, "提示信息"
        End If
    Else
        MsgBox "用户已存在,请重新输入用户名!", vbOKOnly + vbExclamation, "提示信息"
    End If
Else
     MsgBox "请输入完整信息!", vbOKOnly + vbExclamation, "提示信息"
End If
End Sub

⌨️ 快捷键说明

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