📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "“储蓄管理”登录"
ClientHeight = 2730
ClientLeft = 45
ClientTop = 330
ClientWidth = 5400
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2730
ScaleWidth = 5400
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "登录"
Begin VB.ComboBox CboBH
Height = 300
Left = 2160
TabIndex = 0
Top = 360
Width = 2295
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 360
Left = 2940
TabIndex = 5
Tag = "取消"
Top = 1260
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 360
Left = 1335
TabIndex = 4
Tag = "确定"
Top = 1260
Width = 1140
End
Begin VB.TextBox txtPassword
Height = 270
IMEMode = 3 'DISABLE
Left = 2145
PasswordChar = "*"
TabIndex = 2
Top = 765
Width = 2325
End
Begin VB.Label Label1
Caption = "(系统初始用户:admin,密码:admin)"
Height = 255
Left = 1200
TabIndex = 6
Top = 2040
Width = 3135
End
Begin VB.Label lblLabels
Caption = "密码(&P):"
Height = 255
Index = 1
Left = 945
TabIndex = 1
Tag = "密码(&P):"
Top = 780
Width = 1080
End
Begin VB.Label lblLabels
Caption = "用户名(&U):"
Height = 255
Index = 0
Left = 945
TabIndex = 3
Tag = "用户名(&U):"
Top = 390
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Option Explicit
Dim WithEvents adoPrimaryRS As Recordset
Attribute adoPrimaryRS.VB_VarHelpID = -1
Public gblnOK As Boolean
Private Sub Form_Load()
On Error Resume Next
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "Select 编号 from 储蓄管理员 Order By 编号", db, adOpenStatic, adLockReadOnly
'取得储蓄管理员登录清单
Do Until adoPrimaryRS.EOF
CboBH.AddItem adoPrimaryRS("编号")
adoPrimaryRS.MoveNext
Loop
adoPrimaryRS.Close
Set adoPrimaryRS = Nothing '释放对象
End Sub
Private Sub cmdCancel_Click()
gblnOK = False
Hide
End Sub
Private Sub cmdOK_Click()
On Error Resume Next
Dim strBH As String
Dim strKL As String
strBH = Trim(CboBH.Text)
strKL = Trim(txtPassword)
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "Select * From 储蓄管理员 Where 编号='" & strBH & "' And 密码='" & strKL & "'", db, adOpenStatic, adLockReadOnly
'验证用户
If adoPrimaryRS.RecordCount > 0 Then
gblnOK = True
gstrBH = strBH
gstrQX = adoPrimaryRS("超级用户")
Hide
Else
MsgBox Space(10) & "密码错误,再试一次!", "登录" & Space(10)
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
adoPrimaryRS.Close
Set adoPrimaryRS = Nothing '释放对象
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -