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

📄 frmlogin.frm

📁 该仓储管理系统主要完成物料管理 采购管理 人事管理等功能
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   1515
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   3810
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   895.112
   ScaleMode       =   0  'User
   ScaleWidth      =   3577.384
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   3840
      Top             =   360
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _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         =   ""
      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.TextBox txtUser 
      Height          =   345
      Left            =   1320
      TabIndex        =   1
      Top             =   120
      Width           =   2325
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   390
      Left            =   360
      TabIndex        =   4
      Top             =   960
      Width           =   1140
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   390
      Left            =   2160
      TabIndex        =   5
      Top             =   960
      Width           =   1140
   End
   Begin VB.TextBox txtPassword 
      Height          =   345
      IMEMode         =   3  'DISABLE
      Left            =   1320
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   525
      Width           =   2325
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户名称(&U):"
      Height          =   270
      Index           =   0
      Left            =   105
      TabIndex        =   0
      Top             =   150
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      Caption         =   "密码(&P):"
      Height          =   270
      Index           =   1
      Left            =   105
      TabIndex        =   2
      Top             =   540
      Width           =   1080
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim miCount As Integer  '记录用户名或密码输入错误的次数

Private conn As ADODB.Connection

Private rs As ADODB.Recordset

Private rsmc As ADODB.Recordset

Public quanxian As Integer

Public zhuangtai As String

Dim quan As Integer

Public zhuang As String

Public username As String

Sub inputlogin_rz()     '系统日志新增记录过程

 Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\cangchu.mdb;Persist Security Info=False"

 Adodc1.RecordSource = "login_rz"

   Adodc1.Refresh

   Adodc1.Recordset.AddNew

   Adodc1.Recordset.Fields(0) = username
   
   Adodc1.Recordset.Fields(1) = zhuangtai
   
   Adodc1.Recordset.Fields(2) = quanxian

   Adodc1.Recordset.Fields(3) = Format(Date, "yyyy年mm月dd日")  '获取当前的日期格式""

   Adodc1.Recordset.Fields(4) = Format(Time, "hh:mm:ss")

   Adodc1.Recordset.Update

   Adodc1.Refresh

End Sub


Private Sub Cmdcancel_Click()

Unload Me

End Sub

Private Sub Form_Activate()

  Set conn = New ADODB.Connection  '连接数据源

  conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\cangchu.mdb"

  conn.Open

  Set rsmc = New ADODB.Recordset

  rsmc.CursorLocation = adUseClient

  rsmc.Open "login", conn, 1, 1 '打开LOGIN权限管理 数据表

  txtUser.Refresh

End Sub

Private Sub Form_load()

 miCount = 0    '记录错误的用户输入次数
 
 frmLogin.Width = 3870
 
 frmLogin.Height = 1890

End Sub

Private Sub form_unload(Cancel As Integer)

   conn.Close

   Set rs = Nothing

 End Sub



  Private Sub cmdOK_Click()

    inputMain '调入系统登录模块

End Sub

'InputMain()为系统登录模块,系统对密码的检验为3次机会,若3次用户密码都不正确,则视为非法用户,系统自动退出。InputMain过程代码如下:

Private Sub inputMain() '登入系统模块

   Dim txtSQL As String

   If Trim(txtUser.Text = "") Then

      MsgBox "用户名称不能为空,请选择用户名!", vbOKOnly + vbExclamation, "警告"

      txtUser.SetFocus

   Else

      txtSQL = "select * from login where username='" & txtUser.Text & "'"

      Set rs = New ADODB.Recordset

      rs.Open txtSQL, conn, 2, 2

      If rs.BOF = True Then

         MsgBox "对不起,你输入的用户名不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
         
         txtPassword.Text = ""

         txtUser.SetFocus

      Else

         If Trim(rs.Fields(1)) = Trim(txtPassword.Text) Then

            quan = Trim(rs.Fields(2))
            
            quanxian = quan
            
            zhuang = Trim(rs.Fields(3))
          
            zhuangtai = zhuang
            
           rs.Close

          Me.Hide
          
          username = Trim(txtUser.Text)

          inputlogin_rz   '调用该过程 将用户登入信息写入系统日志,所以系统日志的最后一条信息为当前权限信息

          Load frmMain         '装载主窗体

          frmMain.Show

          Exit Sub

      Else

       MsgBox "输入的密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"

       txtPassword.SetFocus

       txtPassword.Text = ""

     End If

  End If

      miCount = miCount + 1

    If miCount = 3 Then

       MsgBox "输入密码错误超过3次,你无权进入系统,谢谢合作", vbOKOnly + vbQuestion, "提示"

       Unload Me

       End

     End If

   End If

    Exit Sub

End Sub

⌨️ 快捷键说明

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