📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 4 'Fixed ToolWindow
Caption = "系统登录"
ClientHeight = 2160
ClientLeft = 3780
ClientTop = 2670
ClientWidth = 4110
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2160
ScaleWidth = 4110
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Tag = "Login"
Begin VB.TextBox txtDate
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 2040
TabIndex = 6
Top = 4320
Width = 2325
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2460
TabIndex = 3
Tag = "Cancel"
Top = 1500
Width = 1140
End
Begin VB.CommandButton cmdOK
BackColor = &H0000FFFF&
Caption = "确认"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 840
TabIndex = 2
Tag = "OK"
Top = 1500
Width = 1140
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
IMEMode = 3 'DISABLE
Left = 1425
PasswordChar = "*"
TabIndex = 1
Top = 765
Width = 2325
End
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1425
TabIndex = 0
Top = 375
Width = 2325
End
Begin VB.Label lbldate
Caption = "业务日期:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 720
TabIndex = 7
Tag = "&User Name:"
Top = 4440
Width = 1080
End
Begin VB.Label lblLabels
Caption = "口令:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 225
TabIndex = 4
Tag = "&Password:"
Top = 780
Width = 1080
End
Begin VB.Label lblLabels
Caption = "用户名称:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 225
TabIndex = 5
Tag = "&User Name:"
Top = 390
Width = 1320
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public ok As Boolean
Private Sub Form_Load()
' txtUserName.text = vbNullString
txtUserName.text = "Administrator"
Me.txtDate = Format(Date, "yyyy-mm-dd")
End Sub
Private Sub Cmdcancel_Click()
ok = False
Me.Hide
End Sub
Private Sub CmdOk_Click()
'ToDo: create test for correct password
'check for correct password
' If Not IsDate(Me.txtDate) Then
' MsgBox "无效的日期输入,请再试一下!", , "系统注册"
' txtDate.SetFocus
' txtDate.SelStart = 0
' txtDate.SelLength = Len(txtDate.text)
' End If
'' If txtPassword.Text = "" Then
'' OK = True
'' Me.Hide
'' Else
'' MsgBox "无效的日期输入,请再试一下!!", , "Login"
'' txtPassword.SetFocus
'' txtPassword.SelStart = 0
'' txtPassword.SelLength = Len(txtPassword.Text)
'' End If
Dim rsx As New Recordset
Dim strSql As String
If Trim(txtPassword) <> vbNullString Then
strSql = "select * from users where username= '" & txtUserName & _
"'and password='" & txtPassword & "'"
Else
strSql = "select * from users where username= '" & txtUserName & _
"'and ( password='' or password is null)"
End If
With rsx
.ActiveConnection = cnnString
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open strSql
'.ActiveConnection.Close
Set .ActiveConnection = Nothing
End With
If rsx.BOF And rsx.EOF Then
MsgBox "用户名称或者口令输入错误,请重新输入!", , "登录错误"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.text)
Else
User.userid = rsx("userid").value
User.username = rsx("username").value
User.password = rsx("password").value
ok = True
Me.Hide
End If
rsx.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -