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

📄 添加用户.frm

📁 zui hao yong de VBxitong
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form5 
   Caption         =   "Form5"
   ClientHeight    =   2790
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   3915
   LinkTopic       =   "Form5"
   ScaleHeight     =   2790
   ScaleWidth      =   3915
   StartUpPosition =   2  '屏幕中心
   Begin VB.CheckBox chkAdmin 
      Caption         =   "是否管理员"
      Height          =   255
      Left            =   1680
      TabIndex        =   8
      Top             =   1800
      Width           =   1455
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   330
      Left            =   2520
      TabIndex        =   7
      Top             =   2280
      Width           =   1215
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   330
      Left            =   1080
      TabIndex        =   6
      Top             =   2280
      Width           =   1215
   End
   Begin VB.TextBox txtpass2 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1680
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1320
      Width           =   2055
   End
   Begin VB.TextBox txtpass 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1680
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   840
      Width           =   2055
   End
   Begin VB.TextBox txtname 
      Height          =   270
      Left            =   1680
      TabIndex        =   3
      Top             =   360
      Width           =   2055
   End
   Begin VB.Label Label4 
      Alignment       =   1  'Right Justify
      Caption         =   "重复密码:"
      Height          =   255
      Left            =   600
      TabIndex        =   2
      Top             =   1440
      Width           =   975
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      Caption         =   "密码:"
      Height          =   375
      Left            =   360
      TabIndex        =   1
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      Caption         =   "用户名:"
      Height          =   255
      Left            =   360
      TabIndex        =   0
      Top             =   480
      Width           =   1215
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
Dim rst As New ADODB.Recordset
Dim sql As String
    If txtname.Text = "" Or txtpass.Text = "" Or txtpass2.Text = "" Then
        MsgBox "各项都不能为空"
        Exit Sub
    End If
    If txtpass2.Text <> txtpass.Text Then
        MsgBox "两次密码不一致"
        Exit Sub
    End If
    sql = "select * from 用户 where 用户名='" & txtname.Text & "'"
    rst.Open sql, conn, adOpenStatic, adLockOptimistic
    If rst.RecordCount = 0 Then
        rst.AddNew
    Else
        MsgBox "该用户名已经被使用"
        rst.Close
        Set rst = Nothing
        Exit Sub
    End If
    rst.Fields("用户名") = txtname.Text
    rst.Fields("密码") = txtpass.Text
    rst.Fields("是否管理员") = IIf(chkAdmin.Value = 1, True, False)
    rst.Update
    rst.Close
    Set rst = Nothing
    Unload Me
End Sub

⌨️ 快捷键说明

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