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

📄 frmadduser.frm

📁 企业人事信息管理系统SQL版企业人事信息实现系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmAddUser 
   Caption         =   "添加用户"
   ClientHeight    =   4965
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5910
   LinkTopic       =   "Form1"
   ScaleHeight     =   4965
   ScaleWidth      =   5910
   StartUpPosition =   3  '窗口缺省
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   495
      Left            =   840
      Top             =   3720
      Visible         =   0   'False
      Width           =   3015
      _ExtentX        =   5318
      _ExtentY        =   873
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   2
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      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 cmbCanel 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2400
      TabIndex        =   7
      Top             =   2880
      Width           =   855
   End
   Begin VB.CommandButton cmbOK 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   6
      Top             =   2880
      Width           =   855
   End
   Begin VB.TextBox txtPassword2 
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   2160
      Width           =   1935
   End
   Begin VB.TextBox txtPassword1 
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   1320
      Width           =   1935
   End
   Begin VB.TextBox txtUserName 
      Height          =   495
      Left            =   1800
      TabIndex        =   1
      Top             =   480
      Width           =   1935
   End
   Begin VB.Label Label3 
      Caption         =   "请确认密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   3
      Top             =   2280
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "请输入密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   1440
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   "请输入用户名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   600
      Width           =   1575
   End
End
Attribute VB_Name = "frmAddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False





Private Sub cmbCanel_Click()
Unload Me

End Sub

Private Sub cmbOK_Click()
 Dim txtSQL As String
 Dim mr As ADODB.Connection
 Dim mrc As ADODB.Recordset
 Dim MsgText As String
 
  Set mr = New ADODB.Connection
  Set mrc = New ADODB.Recordset
  mr.Open ("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=lydiatao;Data Source=WINXP-113")
  mrc.Open "user_info1", mr, adOpenKeyset, adLockOptimistic, adCmdTable
 
' 判断是否为空
 If Trim(txtUserName.Text) = "" Then
    MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
    Exit Sub
    txtUserName.SetFocus
  Else
    txtSQL = "select *from user_Info1 "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    '判断数据集是否为空
    While (mrc.EOF = False)
      '判断是否有重复记录
       If Trim(mrc.Fields(0)) = Trim(txtUserName) Then
         txtUserName.SetFocus
         txtUserName.Text = ""
         txtPassword1.Text = ""
         txtPassword2.Text = ""
         Exit Sub
       Else
       '移动到下一条记录
        mrc.MoveNext
       End If
       Wend
End If
'判断两次输入密码是否一致
If Trim(txtPassword1.Text) <> Trim(txtPassword2.Text) Then
   MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
   txtPassword1.SetFocus
   txtPassword1.Text = ""
   txtPassword2.Text = ""
    Exit Sub
Else
   '判断输入密码是否为空
   If txtPassword1.Text = "" Then
      MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
      txtPassword1.SetFocus
      txtPassword1.Text = ""
      txtPassword2.Text = ""
   Else
      '添加新记录
      mrc.AddNew
      mrc.Fields(0) = Trim(txtUserName.Text)
      mrc.Fields(1) = Trim(txtPassword1.Text)
    
      '更新数据库
      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 + -