📄 login.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H00FFC0C0&
Caption = "商户管理系统"
ClientHeight = 1755
ClientLeft = 60
ClientTop = 450
ClientWidth = 3405
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 1755
ScaleWidth = 3405
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 5
Top = 1200
Width = 855
End
Begin VB.CommandButton Command1
Caption = "进入"
Height = 375
Left = 600
TabIndex = 4
Top = 1200
Width = 855
End
Begin VB.TextBox AllPass
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 1
Top = 720
Width = 1455
End
Begin VB.ComboBox AllUser
Height = 300
Left = 1560
Style = 2 'Dropdown List
TabIndex = 0
Top = 240
Width = 1455
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "登录密码:"
Height = 255
Left = 360
TabIndex = 3
Top = 720
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "登录帐号:"
Height = 255
Left = 360
TabIndex = 2
Top = 240
Width = 1095
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODb.Connection
Dim rs As New ADODb.Recordset
Dim strSql As String
Dim CiShu As Integer
Private Sub AllPass_Change()
If Len(AllPass.Text) > 0 Then
Command1.Default = True
Else
Command1.Default = False
End If
End Sub
Private Sub AllUser_Click()
If AllUser.Text <> "" Then
AllPass.SetFocus
End If
End Sub
Private Sub Command1_Click()
If AllUser.Text = "" Then
MsgBox "请选择你的帐号!", vbOKOnly + vbExclamation, "系统登陆"
AllUser.SetFocus
Exit Sub
ElseIf AllPass.Text = "" Then
MsgBox "请输入你的密码!", vbOKOnly + vbExclamation, "系统登陆"
AllPass.SetFocus
Exit Sub
Else
rs.Close
strSql = "Select * from [管理员] where [登录帐号]='" & AllUser.Text & "' and [登录密码]='" & AllPass.Text & "' "
rs.Open strSql, conn, adOpenKeyset, adLockPessimistic
If AllPass.Text = rs.Fields("登录密码") Then
DengLu = True
UserName = AllUser.Text
ShenFen = rs.Fields("管理等级")
Unload Me
frmMain.Show
'delay 1
'frmWelcome.Show
'delay 2
'Unload frmWelcome
popTiShi = "登录成功!"
frmUpDown.Show
Else
CiShu = CiShu + 1
If CiShu > 3 Then
MsgBox "非法管理员!"
Unload Me
Exit Sub
Else
MsgBox "密码不正确!", vbOKOnly + vbExclamation, "登录失败"
AllPass.Text = ""
AllPass.SetFocus
Exit Sub
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End
End Sub
Private Sub Form_Load()
Me.Caption = App.Title & "-版本V:" & App.Major & "." & App.Minor & "." & App.Revision
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
DBpath = App.Path + "\database\school.mdb"
strSql = "provider=Microsoft.Jet.oledb.4.0;data source=" & DBpath & ";Jet OLEDB:Database Password=" & pwd & ";"
conn.Open strSql
CiShu = 0
strSql = "Select [登录帐号] from [管理员]"
rs.Open strSql, conn, adOpenKeyset, adLockPessimistic
Total = rs.RecordCount
For I = 1 To Total
AllUser.AddItem rs.Fields("登录帐号")
rs.MoveNext
Next I
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -