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

📄 adduser.frm

📁 学校管理系统 V1.0 正式企业版是一款面向中小型企业、个体私营企业
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddUser 
   BackColor       =   &H00FFC0C0&
   Caption         =   "添加帐号"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4065
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4065
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   2160
      TabIndex        =   9
      Top             =   2400
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   375
      Left            =   960
      TabIndex        =   8
      Top             =   2400
      Width           =   975
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1560
      Style           =   2  'Dropdown List
      TabIndex        =   3
      Top             =   1800
      Width           =   1695
   End
   Begin VB.TextBox Text3 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1560
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1320
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1560
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   840
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   270
      Left            =   1560
      TabIndex        =   0
      Top             =   360
      Width           =   1695
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "选择权限"
      Height          =   255
      Left            =   720
      TabIndex        =   7
      Top             =   1800
      Width           =   735
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "确认密码"
      Height          =   255
      Left            =   720
      TabIndex        =   6
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "登录密码"
      Height          =   255
      Left            =   720
      TabIndex        =   5
      Top             =   840
      Width           =   735
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "登录帐号"
      Height          =   255
      Left            =   720
      TabIndex        =   4
      Top             =   360
      Width           =   735
   End
End
Attribute VB_Name = "frmAddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODb.Connection
Dim rs_add As New ADODb.Recordset
Dim sql_add As String


Private Sub Command1_Click()

If Trim(Text1.Text) = "" Then
    MsgBox "登录帐号不能为空"
    Text1.SetFocus
    Exit Sub
ElseIf Text2.Text = "" Then
    Text2.SetFocus
    MsgBox "登录密码不能为空!"
    Exit Sub

ElseIf Text3.Text = "" Then
    Text3.SetFocus
    MsgBox "确认密码不能为空!"
    Exit Sub
ElseIf Text2.Text <> Text3.Text Then
    MsgBox "两次密码不一致", vbOKOnly + vbExclamation, "提示"
    Text2.SetFocus
    Text2.Text = ""
    Text3.Text = ""
    Exit Sub
ElseIf Combo1.Text = "" Then
    Combo1.SetFocus
    MsgBox "请选择用户权限!"
    Exit Sub
Else
    rs_add.Close
    sql_add = "select * from 管理员 where 登录帐号='" & Text1.Text & "'"
    rs_add.Open sql_add, conn, adOpenKeyset, adLockPessimistic

    If rs_add.EOF = False Then
           MsgBox "已有这个用户", vbOKOnly + vbExclamation, "提示"
           Text1.SetFocus
           Text1.Text = ""
           Text2.Text = ""
           Text3.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
       MsgBox "添加用户成功", vbOKOnly + vbExclamation, ""
       Unload Me
    End If
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()

Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2

DBpath = App.Path + "\database\school.mdb"
strSql = "provider=Microsoft.Jet.oledb.4.0;data source=" & DBpath & ";Jet OLEDB:Database Password=" & pwd & ";"
conn.Open strSql

strSql = "Select * from [项目设置]"
rs_add.Open strSql, conn, adOpenKeyset, adLockPessimistic


Total = rs_add.RecordCount

For I = 1 To Total
Combo1.AddItem rs_add.Fields("管理等级")
rs_add.MoveNext
Next I

End Sub


Private Sub Form_Unload(Cancel As Integer)
rs_add.Close
Set rs_add = Nothing
conn.Close
Set conn = Nothing

End Sub

⌨️ 快捷键说明

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