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

📄 loginfrm.frm

📁 一个票务管理软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Loginfrm 
   ClientHeight    =   4740
   ClientLeft      =   2850
   ClientTop       =   3210
   ClientWidth     =   4230
   ControlBox      =   0   'False
   FillColor       =   &H00800000&
   FillStyle       =   0  'Solid
   ForeColor       =   &H80000015&
   LinkTopic       =   "Form1"
   ScaleHeight     =   2800.548
   ScaleMode       =   0  'User
   ScaleWidth      =   3971.74
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtusername 
      BackColor       =   &H80000003&
      Enabled         =   0   'False
      Height          =   349
      Left            =   1440
      TabIndex        =   7
      Top             =   2160
      Width           =   2343
   End
   Begin VB.TextBox txtgonghao 
      Height          =   349
      Left            =   1440
      TabIndex        =   1
      Top             =   1560
      Width           =   2343
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   390
      Left            =   480
      TabIndex        =   4
      Top             =   3720
      Width           =   1140
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   390
      Left            =   2640
      TabIndex        =   5
      Top             =   3720
      Width           =   1140
   End
   Begin VB.TextBox txtPassword 
      Height          =   349
      IMEMode         =   3  'DISABLE
      Left            =   1440
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   2760
      Width           =   2343
   End
   Begin VB.Label Label2 
      Caption         =   "请输入登录用户的工号和密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   720
      TabIndex        =   8
      Top             =   720
      Width           =   3135
   End
   Begin VB.Label Label1 
      Caption         =   "用户姓名:"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   2280
      Width           =   1095
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户工号:"
      Height          =   270
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Top             =   1680
      Width           =   1200
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户密码:"
      Height          =   270
      Index           =   1
      Left            =   240
      TabIndex        =   2
      Top             =   2880
      Width           =   1080
   End
End
Attribute VB_Name = "Loginfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim flagpassword As String
Dim flagadmin As String
Option Explicit
Private Sub cmdcancel_Click()
Me.Hide
End Sub
Private Sub cmdok_Click()
Dim conlogin As New ADODB.Connection
Dim rstlogin As New ADODB.Recordset
   
If Len(Trim(txtgonghao.Text)) = 0 Then
MsgBox "工号为空,请重新输入!!", vbOKOnly
Exit Sub
End If

If Len(Trim(txtPassword.Text)) = 0 Then
MsgBox "用户密码为空,请重新输入!!", vbOKOnly
Exit Sub
End If
  
With conlogin
If .State = adStateOpen Then
   .Close
End If
  .Provider = "microsoft.jet.oledb.4.0"
  .ConnectionString = App.Path & "\jinbin.mdb"
  .Open
End With

With rstlogin
If .State = adStateOpen Then
   .Close
End If
   .LockType = adLockReadOnly
   .CursorLocation = adUseClient
   .CursorType = adOpenDynamic
   .ActiveConnection = conlogin
   .Source = "select * from userinfo"
   .Open
  
If Trim(txtPassword.Text) = flagpassword And Len(Trim(txtPassword.Text)) = Len(flagpassword) Then
If flagadmin = "高级用户" Then
wt.flagnumber = 79802223
Unload Me
mainfrm.Show
ElseIf flagadmin = "一般用户" Then
wt.flagnumber = 32220897
Unload Me
mainfrm.Show
Else
MsgBox "非法人员及权限,请找管理员", vbOKOnly
Exit Sub
End If
Else
MsgBox "密码错误,请重新输入"
Exit Sub
End If
End With
End Sub

Private Sub txtgonghao_LostFocus()
Dim conlogin As New ADODB.Connection
Dim rstlogin As New ADODB.Recordset

If Len(Trim(txtgonghao.Text)) <> 0 Then
With conlogin
If .State = adStateOpen Then
   .Close
End If
   .Provider = "microsoft.jet.oledb.4.0"
   .ConnectionString = App.Path & "\jinbin.mdb"
   .Open
End With

With rstlogin
If .State = adStateOpen Then
   .Close
End If
   .LockType = adLockReadOnly
   .CursorLocation = adUseClient
   .CursorType = adOpenDynamic
   .ActiveConnection = conlogin
   .Source = "select userid,username,userpassword,userjibie from userinfo where userid='" & Trim(txtgonghao.Text) & "'"
   .Open
If .RecordCount <> 0 Then
Do Until .EOF
txtusername.Text = Trim(.Fields!UserName.Value)
flagpassword = Trim(.Fields!userpassword.Value)
flagadmin = Trim(.Fields!userjibie.Value)
.MoveNext
Loop
Else
MsgBox "输入的工号非法,请重新输入", vbOKOnly
txtgonghao.Text = ""
txtgonghao.SetFocus
Exit Sub
End If
End With
End If
End Sub

⌨️ 快捷键说明

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