📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Caption = "登录"
ClientHeight = 2835
ClientLeft = 0
ClientTop = 30
ClientWidth = 5085
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2835
ScaleWidth = 5085
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtPassword
Height = 270
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 1
Top = 1200
Width = 1695
End
Begin VB.TextBox txtUserName
Height = 315
Left = 1920
TabIndex = 0
Top = 720
Width = 1695
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消(&C)"
Height = 375
Left = 2640
TabIndex = 3
Top = 2040
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
Default = -1 'True
Height = 375
Left = 840
TabIndex = 2
Top = 2040
Width = 1455
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Height = 255
Left = 240
TabIndex = 7
Top = 2520
Width = 2895
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
TabIndex = 6
Top = 1680
Width = 1095
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "密码:"
Height = 255
Left = 840
TabIndex = 5
Top = 1200
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 255
Left = 840
TabIndex = 4
Top = 720
Width = 735
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public ok As Boolean
Dim MyValue
Dim LOGINNO As Byte '登录次数
Private Sub Command1_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
'变量定义 txtSQL是用来存放SQL语句,MsgText存放返回信息
Me.MousePointer = 11
UserName = ""
If Trim(txtUserName.Text = "") Then
'判断用户名输入是否为空
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
LOGINNO = LOGINNO + 1
txtUserName.SetFocus
Else
txtSQL = "select * from Manager where username = '" & txtUserName.Text & "'"
'对所输入的用户名进行查询
Set mrc = ExecuteSQL(txtSQL, MsgText)
'MsgBox MsgText
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
LOGINNO = LOGINNO + 1
txtUserName.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
'判断密码输入正确性
ok = True
Level = mrc.Fields(2)
Me.Hide
' UserName = Trim(txtUserName.Text)
' PWD = Trim(txtPassword.Text)
'记录用户名和密码到全局变量
'获取用户的级别
mrc.Close
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
LOGINNO = LOGINNO + 1
End If
End If
End If
If LOGINNO > 3 Then
MsgBox "对不起,您不能使用该系统!", 64, "登录失败"
Me.Hide
Exit Sub
End If
Me.MousePointer = 1
End Sub
Private Sub Command2_Click()
ok = False
Me.Hide
End Sub
Private Sub Form_Load()
ok = True
LOGINNO = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -