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

📄 frmuser.frm

📁 VB ACCESSS数据库课程设计
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmuser 
   Caption         =   "添加用户"
   ClientHeight    =   5205
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7020
   LinkTopic       =   "Form1"
   ScaleHeight     =   5205
   ScaleWidth      =   7020
   StartUpPosition =   3  '窗口缺省
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   4200
      Top             =   4680
      Visible         =   0   'False
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   661
      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       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
      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 cmdexit 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4920
      TabIndex        =   8
      Top             =   3840
      Width           =   1575
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确认"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   960
      TabIndex        =   7
      Top             =   3840
      Width           =   1575
   End
   Begin VB.Frame Frame1 
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   3255
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   6255
      Begin VB.TextBox txtpassword2 
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   1920
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   2400
         Width           =   3375
      End
      Begin VB.TextBox txtpassword1 
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   1920
         PasswordChar    =   "*"
         TabIndex        =   5
         Top             =   1320
         Width           =   3375
      End
      Begin VB.TextBox txtusername 
         Height          =   495
         Left            =   1920
         TabIndex        =   4
         Top             =   360
         Width           =   3375
      End
      Begin VB.Label Label3 
         Caption         =   "请确认密码"
         BeginProperty Font 
            Name            =   "隶书"
            Size            =   15.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   0
         TabIndex        =   3
         Top             =   2520
         Width           =   1935
      End
      Begin VB.Label Label2 
         Caption         =   "请输入密码"
         BeginProperty Font 
            Name            =   "隶书"
            Size            =   15.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   0
         TabIndex        =   2
         Top             =   1440
         Width           =   1935
      End
      Begin VB.Label Label1 
         Caption         =   "请输入用户名"
         BeginProperty Font 
            Name            =   "隶书"
            Size            =   15.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   0
         TabIndex        =   1
         Top             =   480
         Width           =   1935
      End
   End
End
Attribute VB_Name = "frmuser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdok_Click()
'检查各文本框是否为空
If Trim$(txtusername.Text) = "" Then
MsgBox "请输入用户名!", vbExclamation
txtusername.SetFocus
Exit Sub
End If
If Trim$(txtpassword1.Text) = "" Then
MsgBox "请输入密码!", vbExclamation
txtpassword1.SetFocus
Exit Sub
End If
If Trim$(txtpassword2.Text) = "" Then
MsgBox "请确认密码!", vbExclamation
txtpassword2.SetFocus
Exit Sub
End If
'检查两次输入密码是否一致
If Trim$(txtpassword1.Text) <> Trim$(txtpassword2.Text) Then
MsgBox "确认密码错误,请重新输入!", vbExclamation
With txtpassword2
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
Exit Sub
End If
'SQL语句作为ADO控件的记录源
Adodc1.RecordSource = "select * from 用户 where 用户名='" & txtusername.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
If .BOF Then
.AddNew
.Fields(0) = Trim$(txtusername.Text)
.Fields(1) = Trim$(txtpassword1.Text)
.Fields(2) = "普通" '默认权限为普通用户
.Update
MsgBox "添加用户成功!", vbInformation
Else
MsgBox "此用户已存在!", vbExclamation
With txtusername '焦点返回用户框
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
Exit Sub
End If
End With
Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmMain.Show
End Sub

⌨️ 快捷键说明

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