📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
Caption = "身份验证"
ClientHeight = 3645
ClientLeft = 60
ClientTop = 450
ClientWidth = 5535
LinkTopic = "Form1"
ScaleHeight = 3645
ScaleWidth = 5535
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancle
Caption = "取消"
Height = 495
Left = 3240
TabIndex = 5
Top = 2280
Width = 1335
End
Begin VB.CommandButton cmdOK
Caption = "确 定"
Height = 495
Left = 1080
TabIndex = 4
Top = 2280
Width = 1455
End
Begin VB.TextBox text2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 3
Top = 1440
Width = 3015
End
Begin VB.TextBox text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1800
TabIndex = 2
Top = 600
Width = 3015
End
Begin VB.Label Label3
Caption = "注意:如果您的身份验证三次未正确,系统将自动关闭!"
ForeColor = &H000000FF&
Height = 255
Left = 360
TabIndex = 6
Top = 3000
Width = 5055
End
Begin VB.Label Label2
Caption = "密码:"
Height = 375
Left = 600
TabIndex = 1
Top = 1560
Width = 1095
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 375
Left = 600
TabIndex = 0
Top = 720
Width = 1095
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 cnt As Integer '记录确定次数
Private Sub cmdCancle_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim sql As String
Dim rs_login As New ADODB.Recordset
Dim conn As New ADODB.Connection
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database.mdb"
If Trim(Text1.Text) = "" Then
MsgBox "用户名不能为空,请重新输入!"
Text1.SetFocus
Else
sql = "select * from 用户表 where user_ID='" & Trim(Text1.Text) & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = True Then
MsgBox "没有这个用户,请重输入!", vbOKOnly + vbExclamation, ""
Text1.Text = ""
Text1.SetFocus
Else
username = Text1.Text
If Trim(rs_login.Fields(1)) = Trim(Text2.Text) Then
Unload Me
frmMain.Show
Else
MsgBox "密码不正确,请重输入!", vbOKOnly + vbExclamation, ""
Text2.SetFocus
Text2.Text = ""
End If
End If
End If
cnt = cnt + 1
If cnt = 3 Then
Unload Me
End If
End Sub
Private Sub Form_Load()
cnt = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -