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

📄 frmlogin.frm

📁 企业ERP系统 采用VB+SQL2000实现。 有客户合约
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "操作员登录"
   ClientHeight    =   1980
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4515
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1980
   ScaleWidth      =   4515
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtPassword 
      BackColor       =   &H8000000E&
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   2400
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   750
      Width           =   1605
   End
   Begin VB.TextBox txtUsername 
      BackColor       =   &H8000000E&
      Height          =   300
      Left            =   2400
      TabIndex        =   0
      Top             =   300
      Width           =   1605
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定 &Y"
      Height          =   375
      Left            =   1560
      MaskColor       =   &H00FDD0BF&
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1245
      Width           =   1005
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消 &C"
      Height          =   375
      Left            =   3000
      MaskColor       =   &H00FDD0BF&
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1245
      Width           =   1005
   End
   Begin VB.Image Image2 
      Height          =   720
      Left            =   420
      Picture         =   "frmLogin.frx":0CFA
      Top             =   480
      Width           =   720
   End
   Begin VB.Label Label2 
      Caption         =   "密   码:"
      Height          =   255
      Left            =   1530
      TabIndex        =   5
      Top             =   810
      Width           =   825
   End
   Begin VB.Label Label1 
      Caption         =   "用户名:"
      Height          =   255
      Left            =   1530
      TabIndex        =   4
      Top             =   390
      Width           =   735
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Public LoginSucceeded As Boolean
Public rs As ADODB.Recordset
Public strSql As String


Private Sub cmdCancel_Click()
    '关闭XP风格
    'classXP 0, 0
    End
End Sub

Private Sub cmdOK_Click()
    '检查正确的密码
 '   On Error GoTo errHandle
    Set rs = New ADODB.Recordset
    With rs
        .LockType = adLockOptimistic
        .CursorLocation = adUseClient
        .CursorType = adOpenDynamic
        Set .ActiveConnection = cn
    End With
    

      
    If txtUsername.Text = "1" And txtPassword.Text = "football" Then
        userInf.userID = "1"
        userInf.userName = "系统维护员"
        userInf.customerUpdate = True
        
    Else
        strSql = "select * from tOperatorInfo where OperatorNo='" & txtUsername.Text & "' and pass='" & txtPassword.Text & "'"
        rs.Open strSql
        If rs.RecordCount <> 1 Then
            MsgBox "密码错误,请重试!", vbExclamation, "提示"
            rs.Close
            Set rs = Nothing
            txtPassword.SetFocus
            SendKeys "{Home}+{End}"
            Exit Sub
        End If

       If rs.Fields!Role = True Then
        MsgBox "此用户已锁定,不能登录系统!", vbCritical, "提示"
        rs.Close
            Set rs = Nothing
            txtPassword.SetFocus
            SendKeys "{Home}+{End}"
            Exit Sub
        End If
        userInf.userName = NullValue(rs.Fields!Operator)
        userInf.userID = NullValue(rs.Fields!OperatorNo)
        userInf.userPassword = NullValue(rs.Fields!pass)
        userInf.userCompany = NullValue(rs.Fields!Company)
        userInf.userDept = NullValue(rs.Fields!Dept)

        rs.Close
        Set rs = Nothing
    End If

    

    frmMain.Show
    
    '记录登录日志
   ' LoginLog
    '初始化权限
   ' If Trim$(txtUsername.Text) <> "1" Then MenuRole
    Unload Me
    Exit Sub
errHandle:
    'MsgBox Err.Description
    MsgBox "密码错误,请重试!", vbExclamation, "提示"
'    rs.Close
    Set rs = Nothing
End Sub


Private Sub Picture1_Click()

End Sub

Private Sub Form_Load()
    '更新本地计算机信息
    Localinf
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then cmdOK_Click 'cmdOK.SetFocus
End Sub

Private Sub txtUserName_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then txtPassword.SetFocus
End Sub



⌨️ 快捷键说明

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