📄 adminlogin.frm
字号:
VERSION 5.00
Begin VB.Form AdminLogin
BorderStyle = 1 'Fixed Single
Caption = "管理员登陆"
ClientHeight = 3465
ClientLeft = 45
ClientTop = 435
ClientWidth = 4080
Icon = "AdminLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3465
ScaleWidth = 4080
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 3375
Left = 120
TabIndex = 0
Top = 0
Width = 3855
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消"
Height = 495
Left = 2040
TabIndex = 4
Top = 2640
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "登录"
Default = -1 'True
Height = 495
Left = 360
TabIndex = 3
Top = 2640
Width = 1455
End
Begin VB.TextBox User
Appearance = 0 'Flat
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 360
TabIndex = 1
Text = "mincer"
Top = 1320
Width = 3135
End
Begin VB.TextBox Pass
Appearance = 0 'Flat
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
IMEMode = 3 'DISABLE
Left = 360
PasswordChar = "*"
TabIndex = 2
Text = "1"
Top = 2040
Width = 3135
End
Begin VB.Label Label2
Caption = "用户名:"
Height = 255
Left = 360
TabIndex = 7
Top = 1080
Width = 1215
End
Begin VB.Label Label3
Caption = "密码:"
Height = 255
Left = 360
TabIndex = 6
Top = 1800
Width = 735
End
Begin VB.Label Label1
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "财务管理系统"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000002&
Height = 495
Left = 360
TabIndex = 5
Top = 360
Width = 3135
End
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 + -