📄 login.frm
字号:
VERSION 5.00
Begin VB.Form login
BorderStyle = 1 'Fixed Single
Caption = "系统登陆"
ClientHeight = 4005
ClientLeft = 45
ClientTop = 435
ClientWidth = 6000
Icon = "login.frx":0000
LinkTopic = "Form9"
MaxButton = 0 'False
Picture = "login.frx":000C
ScaleHeight = 4005
ScaleWidth = 6000
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 345
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 1
Top = 2400
Width = 1815
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 345
Left = 2280
TabIndex = 0
Top = 1800
Width = 1815
End
Begin VB.Image Image2
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 375
Left = 3360
MouseIcon = "login.frx":13AC4
MousePointer = 99 'Custom
Top = 3360
Width = 975
End
Begin VB.Image Image1
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 375
Left = 1440
MouseIcon = "login.frx":13C16
MousePointer = 99 'Custom
Top = 3360
Width = 975
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
'Download by http://www.codefans.net
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim pnum As Integer
Private Sub Image1_Click()
On Error GoTo finish '防错代码,防止意外而导致的退出
Set fj1 = cnn.Execute("select * from 权限 where 员工号='" & Text1.Text & "' and 密码='" & Text2.Text & "'")
'以上使用最通用的方法来查询数据库中是否有匹配的记录
If fj1.EOF = True Then '如果没有记录则说明用户或密码为错误的
If pnum < 2 Then 'pnum就是密码验证次数,当次数超过3次,系统会自动保护退出
pnum = pnum + 1
MsgBox "用户名或密码错误!", vbInformation, "错误次数:" & pnum
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Exit Sub
Else
MsgBox "用户名或密码错误超过三次,系统会自动退出", vbInformation, "提示"
End
End If
Else
adminname = fj1.Fields(0)
Unload Me
Form1.Show
Form1.Label2.Caption = fj1.Fields(0)
Form1.Label4.Caption = fj1.Fields(1)
End If
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then '获取按键,如果是回车就运行image_click按钮的内容
Call Image1_Click
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Image1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -