📄 login.frm
字号:
VERSION 5.00
Begin VB.Form login
BorderStyle = 1 'Fixed Single
Caption = "请登陆"
ClientHeight = 2115
ClientLeft = 5775
ClientTop = 3495
ClientWidth = 4650
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2115
ScaleWidth = 4650
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 375
Left = 2520
TabIndex = 6
Top = 1560
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "登 陆"
Height = 375
Left = 720
TabIndex = 5
Top = 1560
Width = 1215
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 20
PasswordChar = "*"
TabIndex = 3
Top = 960
Width = 2535
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000002&
Height = 375
Left = 1440
MaxLength = 20
TabIndex = 2
Top = 480
Width = 2535
End
Begin VB.Label Label3
Caption = "请输入正确的用户名和口令登陆系统"
Height = 255
Left = 600
TabIndex = 4
Top = 120
Width = 3135
End
Begin VB.Image Image1
Height = 480
Left = 0
Picture = "login.frx":0000
Top = 360
Width = 480
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 = 375
Left = 600
TabIndex = 1
Top = 960
Width = 1095
End
Begin VB.Label Label1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 0
Top = 480
Width = 975
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Dim Errtimes As Integer
Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = False
Dim User As String
Dim Password As String
Dim Ssql As String
Dim Rrs As ADODB.Recordset
User = Text1.Text
Password = Text2.Text
Userpassword = Password '存放当前用户的密码
Ssql = "select Userpassword,Usertype from userinfo where Username='" & Trim(User) & "" & "'"
' MsgBox Ssql '测试用的
Set Rrs = New ADODB.Recordset
If Not mExecuteSql(Ssql, Rrs) Then
' MsgBox "数据库执行错误!", vbCritical + vbOKOnly
Command1.Enabled = True
Command2.Enabled = True
Exit Sub
End If
If Rrs.EOF Then '不存在这个用户
MsgBox "用户名或密码不正确,请重新输入!请确定是否因为疏忽而按下了Caps Lock。", vbOKOnly + vbInformation, "无法登陆"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Command1.Enabled = True
Command2.Enabled = True
Rrs.Close
Exit Sub
End If
If Rrs.Fields(0) & "" = Password Then '身份验证成功
UserType = Rrs.Fields(1) & ""
UserName = User
Rrs.Close
frmTerminal.Show
Unload Me
Else '登陆失败,即密码不正确
MsgBox "用户名或密码不正确,请重新输入!请确定是否因为疏忽而按下了Caps Lock。", vbOKOnly + vbInformation, "无法登陆"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Command1.Enabled = True
Command2.Enabled = True
Rrs.Close
Exit Sub
End If
Command1.Enabled = True
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'Errtimes = 0 '初始登陆错误次数为0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -