📄 adminlogin.frm
字号:
VERSION 5.00
Begin VB.Form AdminLogin
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3690
ClientLeft = 0
ClientTop = 0
ClientWidth = 5760
LinkTopic = "Form1"
Picture = "AdminLogin.frx":0000
ScaleHeight = 3690
ScaleWidth = 5760
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 495
Left = 3720
TabIndex = 3
Top = 2640
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "登 录"
Height = 495
Left = 960
TabIndex = 2
Top = 2640
Width = 1335
End
Begin VB.TextBox pass
Appearance = 0 'Flat
Height = 270
IMEMode = 3 'DISABLE
Left = 3600
PasswordChar = "*"
TabIndex = 1
Top = 1920
Width = 1815
End
Begin VB.TextBox User
Appearance = 0 'Flat
Height = 270
Left = 3600
TabIndex = 0
Top = 1320
Width = 1815
End
End
Attribute VB_Name = "AdminLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim sql As String
Dim rs As New ADODB.Recordset
If User.Text = "" Then '保证用户名和密码都填写
MsgBox "用户名不能为空!", vbCritical
User.SetFocus
Exit Sub
End If
If Pass.Text = "" Then
MsgBox "密码不能为空!", vbCritical
Pass.SetFocus
Exit Sub
End If
If DbHandle.DbConnection Then
sql = "TBL_ADMIN" '用SQL语句判断是否是合法管理员
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.Filter = "ADMIN_ID='" & User.Text & "' AND ADMIN_PASSWORD='" & Pass.Text & "'"
rs.Open sql, DbFinance
If DbHandle.resultcount(rs) <> 1 Then '不存在管理员记录提示错误信息并且退出系统
MsgBox "用户名或密码错误!", vbExclamation
rs.Close
Set rs = Nothing
DbHandle.DbClose
End
End If
DbHandle.DbClose
mainform.Show '登陆成功显示主窗体
Unload Me
Else
MsgBox "数据库错误!", vbExclamation
DbHandle.DbClose
End
End If
End Sub
Private Sub Command2_Click()
End '点击取消退出管理系统
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.ScaleWidth) / 2 '登陆窗体居中显示
Me.Top = (Screen.Height - Me.ScaleHeight) / 2
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
DbHandle.DbClose
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -