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

📄 tjyh.frm

📁 一个关于企业工资管理的数据库应用的例子。
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmAddUsers 
   AutoRedraw      =   -1  'True
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加超级用户"
   ClientHeight    =   3075
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5235
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3075
   ScaleWidth      =   5235
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   1680
      Negotiate       =   -1  'True
      Top             =   3360
      Visible         =   0   'False
      Width           =   2175
      _ExtentX        =   3836
      _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=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
      OLEDBString     =   "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   3120
      TabIndex        =   8
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   1200
      TabIndex        =   7
      Top             =   2640
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Height          =   2295
      Left            =   720
      TabIndex        =   0
      Top             =   120
      Width           =   3855
      Begin VB.TextBox Text3 
         Height          =   315
         IMEMode         =   3  'DISABLE
         Left            =   2040
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   1680
         Width           =   1575
      End
      Begin VB.TextBox Text2 
         Height          =   315
         IMEMode         =   3  'DISABLE
         Left            =   2040
         PasswordChar    =   "*"
         TabIndex        =   5
         Top             =   1080
         Width           =   1575
      End
      Begin VB.TextBox Text1 
         Height          =   315
         Left            =   2040
         TabIndex        =   4
         Top             =   480
         Width           =   1575
      End
      Begin VB.Label Label3 
         Caption         =   "再次输入密码:"
         Height          =   375
         Left            =   120
         TabIndex        =   3
         Top             =   1680
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "用户密码:"
         Height          =   375
         Left            =   120
         TabIndex        =   2
         Top             =   1080
         Width           =   1455
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "用户名:"
         Height          =   315
         Left            =   120
         TabIndex        =   1
         Top             =   480
         Width           =   1455
      End
   End
End
Attribute VB_Name = "FrmAddUsers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit



Private Sub Command1_Click()

Dim conn As New ADODB.Connection
conn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
conn.Open
If Trim(Text1.Text) <> Empty And Trim(Text2.Text) <> Empty And Trim(Text3.Text) <> Empty Then
    If Len(Trim(Text2.Text)) <= 15 And Len(Trim(Text3.Text)) <= 15 Then
        If Trim(Text2.Text) = Trim(Text3.Text) Then       '//验证两次输入密码是否一致
On Error GoTo ErrAddUser
            conn.Execute "insert into  admin(adminid,adminpass)values('" & Text1.Text & "','" & Text2.Text & "')"        '更新记录
            MsgBox "用户添加成功", , "添加成功"
            Text1 = ""
            Text2 = ""
            Text3 = ""
            Text1.SetFocus
        Else
            MsgBox "两次密码不一致 ", vbExclamation + vbOKOnly, "验证错误"         '两次密码不一致时
            Text2 = ""
            Text3 = ""
            Text2.SetFocus
            End If
    Else
        MsgBox "用户名与密码长度不能大于15", vbInformation + vbOKOnly, "验证错误"
    End If
Else
    MsgBox "请输入要添加的用户名及密码 ", vbInformation + vbOKOnly, "错误提示"
End If
Exit Sub
ErrAddUser:
MsgBox "用户已存在 ", vbInformation + vbOKOnly, "提示信息"
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

⌨️ 快捷键说明

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