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

📄 f重新登录.frm

📁 用VB作的人事管理系统数据库为SQL Server利用了第三方控件技术还有AxtiveX技术等很好
💻 FRM
字号:
VERSION 5.00
Begin VB.Form F重新登录 
   Caption         =   "重新登录"
   ClientHeight    =   2100
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   3900
   LinkTopic       =   "Form1"
   ScaleHeight     =   2100
   ScaleWidth      =   3900
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Caption         =   "登录信息"
      Height          =   2055
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   3855
      Begin VB.CommandButton CmdCancel 
         BackColor       =   &H00C0C0C0&
         Caption         =   "退出(&Q)"
         Height          =   360
         Left            =   2040
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   1560
         Width           =   800
      End
      Begin VB.CommandButton CmdOk 
         BackColor       =   &H00C0C0C0&
         Caption         =   "确定(&O)"
         Height          =   360
         Left            =   960
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   1560
         Width           =   800
      End
      Begin VB.ComboBox CboName 
         Height          =   315
         Left            =   1455
         TabIndex        =   2
         Text            =   "administrator"
         Top             =   360
         Width           =   1920
      End
      Begin VB.TextBox txtPassword 
         Height          =   345
         IMEMode         =   3  'DISABLE
         Left            =   1455
         PasswordChar    =   "*"
         TabIndex        =   1
         Top             =   840
         Width           =   1845
      End
      Begin VB.Label lblLabels 
         Caption         =   "用户名称(&U):"
         Height          =   270
         Index           =   0
         Left            =   360
         TabIndex        =   4
         Top             =   390
         Width           =   1080
      End
      Begin VB.Label lblLabels 
         Caption         =   "密码(&P):"
         Height          =   270
         Index           =   1
         Left            =   360
         TabIndex        =   3
         Top             =   840
         Width           =   1080
      End
   End
End
Attribute VB_Name = "F重新登录"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SQL As String
Dim msg As String
Private Sub Form_Load()
    Dim rst As ADODB.Recordset
    Dim strItem As String
    '初始化ComboBox
    SQL = " select 用户ID,用户名称 from 用户信息表 order by 用户ID"
    Set rst = SelectSQL(SQL, msg)
    If rst.RecordCount > 0 Then
        Do While Not rst.EOF
        '添加到ComboBox列表
        strItem = rst.Fields(0) & " " & rst.Fields(1)
        CboName.AddItem (strItem)
        rst.MoveNext                            '指向下一条记录
        Loop
        rst.Close
        CboName.ListIndex = 0                   '默认ComboBox
    Else
        MsgBox ("请先创建用户信息!")
        CmdOK.Enabled = False
        Exit Sub
    End If
End Sub
Private Sub CmdOK_Click()
    Dim rst As ADODB.Recordset
    Dim password As String
    '判断用户是否存在
    UserID = Left(Trim(CboName.Text), 10)       '取出用户的ID
    SQL = " select 用户ID,密码 from 用户信息表 where 用户ID='" & UserID & "'"
    Set rst = SelectSQL(SQL, msg)
    If rst.RecordCount > 0 Then                 '如果存在这个用户
        password = Trim(rst.Fields(1))          '取出该用户的密码
        rst.Close
    Else
        MsgBox ("数据库操作错误!")
        Exit Sub
    End If
    '判断密码是否正确
    If password = Trim(txtPassword.Text) Then
      LoginSucceeded = True
      人事管理系统.Show
      Unload Me
    Else
      MsgBox ("密码错误!")
      LoginSucceeded = False
    End If
End Sub
Private Sub cmdCancel_Click()
    '设置全局变量为 false
    '不提示失败的登录
    LoginSucceeded = False
    Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
    LoginSucceeded = False
    Unload Me
End Sub


⌨️ 快捷键说明

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