📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form logIn
BorderStyle = 1 'Fixed Single
Caption = "登陆"
ClientHeight = 3000
ClientLeft = 45
ClientTop = 435
ClientWidth = 4590
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3000
ScaleWidth = 4590
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox passwordText2
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 5
Top = 1440
Width = 1935
End
Begin VB.TextBox userNameText1
Height = 375
Left = 1800
TabIndex = 4
Top = 720
Width = 1935
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2640
TabIndex = 1
Top = 2160
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 480
TabIndex = 0
Top = 2160
Width = 1455
End
Begin VB.Label Label2
Caption = "密码"
Height = 255
Left = 600
TabIndex = 3
Top = 1560
Width = 855
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 600
TabIndex = 2
Top = 840
Width = 855
End
End
Attribute VB_Name = "logIn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim logInJudge As Boolean
Dim passwordCount As Byte
Private Sub Form_Load()
logInJudge = False
admin = False
passwordCount = 0
userName = ""
userNametext1.Text = ""
passwordText2.Text = ""
End Sub
Private Sub Command1_Click()
Dim SQLtext As String
Dim tempPoint As ADODB.Recordset
If Trim(userNametext1.Text) = "" Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "错误"
userNametext1.SetFocus
Else
SQLtext = "select * from 职工表 where 职工号='" & userNametext1.Text & "'"
Set tempPoint = ExecuteSQL(SQLtext)
If tempPoint.EOF = True Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "错误"
userNametext1.Text = ""
passwordText2.Text = ""
userNametext1.SetFocus
Else
If tempPoint.Fields(2) = passwordText2.Text Then
logInJudge = True
userID = tempPoint.Fields(0)
userName = tempPoint.Fields(1)
admin = tempPoint.Fields(3) '确定是否管理员,全局变量
tempPoint.Close
Me.Hide
Else
MsgBox "密码错误,请重新输入!", vbOKOnly + vbExclamation, "错误"
passwordText2.Text = ""
passwordText2.SetFocus
passwordText2.Text = ""
End If
End If
End If
passwordCount = passwordCount + 1
If passwordCount > 10 Then
Unload Me
End If
If logInJudge Then
MsgBox userName & "欢迎您登陆!", vbOKOnly + vbExclamation, "欢迎"
MDIForm1.Show
Unload Me
End If
End Sub
Private Sub Command2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -