📄 frmlogin_second.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin_second
BorderStyle = 3 'Fixed Dialog
Caption = "系统登录"
ClientHeight = 1890
ClientLeft = 4335
ClientTop = 3450
ClientWidth = 3855
Icon = "frmLogin_second.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1116.673
ScaleMode = 0 'User
ScaleWidth = 3619.636
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.ComboBox Combo1
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 1770
TabIndex = 5
Top = 300
Width = 1755
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 390
Left = 1770
TabIndex = 3
Top = 1380
Width = 780
End
Begin VB.CommandButton cmdCancel
BackColor = &H8000000A&
Cancel = -1 'True
Caption = "取消"
Height = 390
Left = 2790
TabIndex = 4
Top = 1380
Width = 720
End
Begin VB.TextBox txtPassword
BackColor = &H00C0FFFF&
DataField = "password"
DataSource = "Data1"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
IMEMode = 3 'DISABLE
Left = 1770
PasswordChar = "*"
TabIndex = 2
Top = 900
Width = 1725
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户名称(&U):"
BeginProperty Font
Name = "宋体"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 420
Index = 0
Left = 180
TabIndex = 0
Top = 300
Width = 1530
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密码(&P):"
BeginProperty Font
Name = "宋体"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 360
Index = 1
Left = 210
TabIndex = 1
Top = 930
Width = 1275
End
End
Attribute VB_Name = "frmLogin_second"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strsloadql As String
Dim chkpassword As String '检查密码是否正确
Public LoginSucceeded As Boolean '全局变量表示登陆是否成功
Private Sub cmdCancel_Click()
'设置全局变量为 false
'不提示失败的登录
LoginSucceeded = False
Me.Hide
Unload Me
End Sub
Private Sub cmdOK_Click()
If Combo1.Text = "" Then
MsgBox "别忘了选择用户名:)", vbOKOnly, ":("
Exit Sub
End If
'检查正确的密码
If txtPassword.Text <> "" Then
If txtPassword.Text = chkpassword Then
LoginSucceeded = True
Call condatabase
Set rsload = New ADODB.Recordset
rsload.open "select * from user_load where user_name='" & Combo1.Text & "'", cn, adOpenStatic, adLockPessimistic
If rsload.Fields("ql_flag") <> "" Then
czry_flag = rsload.Fields("ql_flag").Value
Else
czry_flag = "00000000000000"
End If
Dim rsczry As ADODB.Recordset
Set rsczry = New ADODB.Recordset
rsczry.open "select * from czry", cn, adOpenStatic, adLockPessimistic
rsczry.Fields(1).Value = Combo1.Text
rsczry.Update
rsczry.close
mainform.StatusBar1.Panels(2).Text = "操作人员: " & Combo1.Text
mainform.StatusBar1.Panels(1).Text = "状态: 无"
Unload Me
mainform.Show
Else
MsgBox "无效的密码,请重试!", , "登录"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
txtPassword.Text = ""
Else
MsgBox "别忘了输入密码:)", vbOKOnly, ":("
End If
End Sub
Private Sub Combo1_Click()
Call condatabase
Set rsload = New ADODB.Recordset
rsload.open "select password from user_load where user_name='" & Combo1.Text & "'", cn, adOpenStatic, adLockPessimistic
txtPassword.SetFocus
chkpassword = rsload.Fields("password")
End Sub
Private Sub Form_Initialize()
txtPassword.Text = ""
End Sub
Private Sub Form_Load()
Call condatabase
Dim rsload As ADODB.Recordset
Set rsload = New ADODB.Recordset
strsloadql = "select * from user_load"
Set rsload = cn.Execute(strsloadql)
Combo1.Clear
Do Until rsload.EOF
Combo1.AddItem rsload.Fields("user_name")
rsload.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -