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

📄 frmadduser.frm

📁 图书馆管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmadduser 
   Caption         =   "添加用户"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5400
   LinkTopic       =   "Form2"
   Picture         =   "frmadduser.frx":0000
   ScaleHeight     =   3090
   ScaleWidth      =   5400
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text3 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   3240
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   1560
      Width           =   1935
   End
   Begin VB.TextBox Text2 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   3240
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   600
      Width           =   1935
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   480
      TabIndex        =   3
      Text            =   "Combo1"
      Top             =   1560
      Width           =   2055
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   480
      TabIndex        =   1
      Top             =   600
      Width           =   2055
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "确认密码:"
      ForeColor       =   &H0080C0FF&
      Height          =   255
      Left            =   2880
      TabIndex        =   7
      Top             =   1320
      Width           =   975
   End
   Begin VB.Image Image2 
      Height          =   270
      Left            =   3120
      Picture         =   "frmadduser.frx":329D1
      Top             =   2400
      Width           =   1935
   End
   Begin VB.Image Image1 
      Height          =   270
      Left            =   1680
      Picture         =   "frmadduser.frx":33759
      Top             =   2400
      Width           =   1935
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "输入密码:"
      ForeColor       =   &H0080C0FF&
      Height          =   255
      Left            =   2880
      TabIndex        =   4
      Top             =   360
      Width           =   975
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "选择权限:"
      ForeColor       =   &H0080C0FF&
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   1200
      Width           =   975
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "输入用户名:"
      ForeColor       =   &H0080C0FF&
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   1095
   End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Combo1.AddItem "管理员"
Combo1.AddItem "读者"
End Sub

Private Sub Image1_Click()
Dim sql As String
Dim rs_add As New ADODB.Recordset
If Trim(Text1.Text) = "" Then
   MsgBox "用户名不能为空", vbOKOnly + vbExclamation, ""
   Exit Sub
   Text1.SetFocus
Else
   sql = "select * from pass"
   rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic
   While (rs_add.EOF = False)
        If Trim(rs_add.Fields(0)) = Trim(Text1.Text) Then
           MsgBox "已有这个用户", vbOKOnly + vbExclamation, ""
           Text1.SetFocus
           Text1.Text = ""
           Text2.Text = ""
           Text3.Text = ""
           Combo1.Text = ""
           Exit Sub
         Else
           rs_add.MoveNext
         End If
    Wend
    If Trim(Text2.Text) <> Trim(Text3.Text) Then
       MsgBox "两次密码不一致", vbOKOnly + vbExclamation, ""
       Text2.SetFocus
       Text2.Text = ""
       Text3.Text = ""
       Exit Sub
    ElseIf Trim(Combo1.Text) <> "管理员" And Trim(Combo1.Text) <> "读者" Then
       MsgBox "请选择正确的用户权限", vbOKOnly + vbExclamation, ""
       Combo1.SetFocus
       Combo1.Text = ""
       Exit Sub
    Else
       rs_add.AddNew
       rs_add.Fields("名称") = Text1.Text
       rs_add.Fields("密码") = Text2.Text
       rs_add.Fields("权限") = Combo1.Text
       rs_add.Update
       rs_add.Close
       MsgBox "添加用户成功", vbOKOnly + vbExclamation, ""
       Unload Me
    End If
End If
End Sub

Private Sub Image2_Click()
Unload Me
End Sub

⌨️ 快捷键说明

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