📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmLogin
BorderStyle = 1 'Fixed Single
Caption = "身份验证"
ClientHeight = 2580
ClientLeft = 45
ClientTop = 330
ClientWidth = 4800
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2580
ScaleWidth = 4800
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 240
Top = 1680
Visible = 0 'False
Width = 1695
_ExtentX = 2990
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 2
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "FILE NAME=D:\EMSystem\database\login.dsn;1"
OLEDBString = ""
OLEDBFile = "D:\EMSystem\database\login.dsn"
DataSourceName = ""
OtherAttributes = "1"
UserName = ""
Password = ""
RecordSource = "users"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 2640
TabIndex = 6
Top = 1920
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 720
TabIndex = 5
Top = 1920
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 4
Top = 1080
Width = 2295
End
Begin VB.Frame Frame1
Height = 1575
Left = 480
TabIndex = 0
Top = 120
Width = 3855
Begin VB.TextBox Text1
Height = 375
Left = 1080
TabIndex = 3
Top = 360
Width = 2295
End
Begin VB.Label Label2
Caption = "密 码"
Height = 375
Left = 360
TabIndex = 2
Top = 1080
Width = 735
End
Begin VB.Label Label1
Caption = "用户名"
Height = 375
Left = 360
TabIndex = 1
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim strusername As String
Dim strpassword As String
Static intlogintimes As Integer
If Trim(Text1.Text) = "" Then
MsgBox "用户名不能为空!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Exit Sub
End If
Adodc1.Refresh
Adodc1.Recordset.Find "username='" & Text1.Text & " '", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
strusername = Adodc1.Recordset!UserName
strpassword = Adodc1.Recordset!userpwd
Else
strusername = ""
strpassword = ""
End If
If strusername = Text1.Text And strpassword = Text2.Text Then
Adodc1.Recordset.Close
Unload Me
FrmMain.Show
Else
MsgBox "用户名或密码不对!", vbOKOnly + vbExclamation, "提示"
intlogintimes = intlogintimes + 1
If intlogintimes >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭。"
Adodc1.Recordset.Close
End
End If
Text2.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -