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

📄 frm_sys.frm

📁 中小型企业员工管理系统 教程 教程 教程 教程 教程
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Frm_sys 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "用户管理"
   ClientHeight    =   3645
   ClientLeft      =   3645
   ClientTop       =   2925
   ClientWidth     =   4470
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3645
   ScaleWidth      =   4470
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "增加"
      Height          =   350
      Left            =   1005
      TabIndex        =   11
      Top             =   3240
      Width           =   795
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   600
      Top             =   4530
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   24
      ImageHeight     =   24
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   1
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Frm_sys.frx":0000
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ListView ListView1 
      Height          =   1950
      Left            =   105
      TabIndex        =   10
      Top             =   75
      Width           =   4245
      _ExtentX        =   7488
      _ExtentY        =   3440
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      Icons           =   "ImageList1"
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   3630
      Top             =   5550
      Width           =   2415
      _ExtentX        =   4260
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      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 Cmd_Cancel 
      Caption         =   "取消"
      Height          =   350
      Left            =   3540
      TabIndex        =   6
      Top             =   3240
      Width           =   795
   End
   Begin VB.CommandButton Cmd_Add 
      Caption         =   "保存"
      Height          =   350
      Left            =   1845
      TabIndex        =   4
      Top             =   3240
      Width           =   795
   End
   Begin VB.CommandButton Cmd_Del 
      Caption         =   "删除"
      Height          =   350
      Left            =   2685
      TabIndex        =   5
      Top             =   3240
      Width           =   795
   End
   Begin VB.Frame Frame2 
      Caption         =   "用户信息"
      Height          =   1095
      Left            =   135
      TabIndex        =   0
      Top             =   2100
      Width           =   4215
      Begin VB.TextBox Text4 
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   2985
         PasswordChar    =   "*"
         TabIndex        =   9
         Top             =   675
         Width           =   1095
      End
      Begin VB.TextBox Text3 
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   990
         PasswordChar    =   "*"
         TabIndex        =   8
         Top             =   660
         Width           =   1065
      End
      Begin VB.TextBox Text1 
         Height          =   300
         Left            =   1005
         TabIndex        =   7
         Top             =   240
         Width           =   1050
      End
      Begin VB.Label Label3 
         Caption         =   "确认密码"
         Height          =   225
         Left            =   2130
         TabIndex        =   3
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "用户密码"
         Height          =   195
         Left            =   135
         TabIndex        =   2
         Top             =   750
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "用户名称"
         Height          =   255
         Left            =   135
         TabIndex        =   1
         Top             =   285
         Width           =   855
      End
   End
End
Attribute VB_Name = "Frm_sys"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a
'用户注册信息的事件代码
Private Sub cmd_add_Click()
  If Text1.Text = "" Or Text3.Text = "" Then
  MsgBox "输入的用户注册信息不完全!!", , "提示信息"
  Else
   On Error Resume Next
   '判断注册的用户名是否存在
   Adodc1.RecordSource = "select * from 用户信息 where 用户名='" + Text1 + "'"
   Adodc1.Refresh
      If Adodc1.Recordset.RecordCount > 0 Then
        MsgBox "该用户名已经存在,请您更换其他用户名!", 48, "提示信息"
         '如果该用户名存在则重新输入
        Text1.Text = ""
        Text3.Text = ""
        Text4.Text = ""
        Text1.SetFocus
      Else

    If Text3.Text = Text4.Text Then                      '判断两次输入的密码是否一致
        DB_AdoRs.Open "select * from 用户信息 where 用户名='" + Text1.Text + "'", Cnn, adOpenKeyset
             If DB_AdoRs.RecordCount > 0 Then
                    DB_AdoRs.MoveLast
                    Dim StrId
                    StrId = Val(DB_AdoRs.Fields("编号")) + 1
             Else
                      StrId = 1
             End If
                               '保存注册信息
                  Set DB_AdoRs = Cnn.Execute("insert into 用户信息 values(" & StrId & ",'" & Text1 & "','" & Text3 & "')")
                   MsgBox "注册成功!!", 48, "信息提示"
                      Adodc1.ConnectionString = MyStrs
                      Adodc1.RecordSource = "select * from 用户信息"
                      Adodc1.Refresh
                          If Adodc1.Recordset.RecordCount > 0 Then
                            ListView1.Enabled = True
                            ListView1.ListItems.Clear
                            Adodc1.Recordset.MoveFirst
                            '将操作员信息添加到ListView控件当中
                            Do While Adodc1.Recordset.EOF = False
                               key = Adodc1.Recordset.Fields("用户名")
                               Set itmX = ListView1.ListItems.Add(, , key, 1)
                               Adodc1.Recordset.MoveNext
                            Loop
                          End If

                     Text1.Text = ""
                     Text3.Text = ""
                     Text4.Text = ""
               DB_AdoRs.Close
      Else
              MsgBox "两次输入的密码不一致,请重新输入", 48, "信息提示"
              Text3.Text = ""
              Text4.Text = ""
              Text3.SetFocus
      End If
  End If
 End If
End Sub
Private Sub cmd_del_Click()
  If Text1.Text = "Admin" Then
     MsgBox "超级用户不能够被删除", 48, "提示信息"
  Else
     If Text1.Text = Name1 Then                        '如果是当前登录的用户名,则不允许删除
         MsgBox "不能删除当前用户名!!", 48, "提示信息"
     Else
         a = MsgBox("您确认要删除该用户吗?", 17, "删除用户信息提示")
            If a = vbOK Then
                 Adodc1.RecordSource = "select * from 用户信息 where 用户名='" + Text1.Text + "'"
                 Adodc1.Refresh
                      If Adodc1.Recordset.RecordCount > 0 Then
                             Adodc1.Recordset.Delete                      '如果数据库中存在该用户信息,则将其删除
                             MsgBox "用户信息删除成功", 64, "删除用户信息提示"
                               Adodc1.ConnectionString = MyStrs
                               Adodc1.RecordSource = "select * from 用户信息"
                               Adodc1.Refresh
                                   If Adodc1.Recordset.RecordCount > 0 Then
                                     ListView1.Enabled = True
                                     ListView1.ListItems.Clear
                                     Adodc1.Recordset.MoveFirst
                                     Do While Adodc1.Recordset.EOF = False                   '将操作员信息添加到ListView控件当中
                                        key = Adodc1.Recordset.Fields("用户名")
                                        Set itmX = ListView1.ListItems.Add(, , key, 1)
                                        Adodc1.Recordset.MoveNext
                                     Loop
                                   End If
                                   
                                     Text1.Text = ""
                                     Text3.Text = ""
                                     Text4.Text = ""
                                     Text1.SetFocus

                      Else
                             MsgBox "当前数据库中没有可删除的用户信息", , "信息提示"
                      End If
              End If
      End If
  End If
End Sub

Private Sub Cmd_Cancel_Click()
  Unload Me
End Sub

Private Sub Command1_Click()
  Text1.Text = ""
  Text3.Text = ""
  Text4.Text = ""
  Text1.SetFocus
End Sub

Private Sub Form_Load()
   Adodc1.ConnectionString = MyStrs
   Adodc1.RecordSource = "select * from 用户信息"
   Adodc1.Refresh
   If Adodc1.Recordset.RecordCount > 0 Then
     ListView1.Enabled = True
     '清空ListView控件中的元素信息
     ListView1.ListItems.Clear
     Adodc1.Recordset.MoveFirst
     Do While Adodc1.Recordset.EOF = False
        '将操作员信息添加到ListView控件当中
        key = Adodc1.Recordset.Fields("用户名")
        Set itmX = ListView1.ListItems.Add(, , key, 1)
        Adodc1.Recordset.MoveNext
     Loop
   Else
      ListView1.Enabled = False
   End If
End Sub

Private Sub ListView1_Click()
Adodc1.RecordSource = "select * from 用户信息 where 用户名='" + ListView1.SelectedItem + "'"
Adodc1.Refresh
  On Error Resume Next
    If Adodc1.Recordset.RecordCount > 0 Then
        Text1.Text = Adodc1.Recordset.Fields("用户名")
    End If
End Sub

⌨️ 快捷键说明

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