📄 frmdl.frm
字号:
VERSION 5.00
Begin VB.Form frmdl
BackColor = &H0000C0C0&
BorderStyle = 1 'Fixed Single
Caption = "系统身份验证"
ClientHeight = 3105
ClientLeft = 45
ClientTop = 330
ClientWidth = 4350
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 3105
ScaleWidth = 4350
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H0000C0C0&
BorderStyle = 0 'None
Height = 240
Index = 0
Left = 240
Picture = "frmdl.frx":0000
ScaleHeight = 240
ScaleWidth = 240
TabIndex = 8
Top = 1680
Width = 240
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H0000C0C0&
BorderStyle = 0 'None
Height = 240
Index = 1
Left = 240
Picture = "frmdl.frx":014A
ScaleHeight = 240
ScaleWidth = 240
TabIndex = 7
Top = 1080
Width = 240
End
Begin VB.CommandButton Commcancel
Caption = "取消"
Height = 375
Left = 2400
TabIndex = 6
Top = 2400
Width = 975
End
Begin VB.CommandButton Commok
Caption = "确定"
Height = 375
Left = 960
TabIndex = 5
Top = 2400
Width = 975
End
Begin VB.TextBox Text2
BackColor = &H00008000&
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
MaxLength = 20
PasswordChar = "*"
TabIndex = 4
Top = 1680
Width = 2175
End
Begin VB.TextBox Text1
BackColor = &H00008000&
Height = 375
Left = 1800
MaxLength = 20
TabIndex = 3
Top = 1080
Width = 2175
End
Begin VB.Label Label3
BackColor = &H0000C0C0&
Caption = "密码:"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 2
Top = 1680
Width = 1095
End
Begin VB.Label Label2
BackColor = &H0000C0C0&
Caption = "用户名:"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 1
Top = 1080
Width = 1095
End
Begin VB.Label Label1
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "欢迎使用户籍管理系统"
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 0
Top = 240
Width = 3855
End
End
Attribute VB_Name = "frmdl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Commcancel_Click()
End
End Sub
Private Sub Commok_Click()
'声明变量
Dim username As String
Dim password As String
Dim local_db As String
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
If Text1.Text = "" Then
MsgBox "请输入用户名", , "警告"
Text1.SetFocus
Else
If Text2.Text = "" Then
MsgBox "请输入密码", , "警告"
Text2.SetFocus
End If
End If
If Text1.Text <> "" And Text2.Text <> "" Then
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '连接数据库
username = Trim(Text1.Text)
password = Text2.Text
'检查用户名是否正确
local_db = "select 用户名 from 用户表" + _
" where 用户表.用户名=" + "'" + _
username + "'"
rst.Open local_db, cnn
If Not (rst.BOF And rst.EOF) Then
rst.Close
'检查密码是否正确
local_db = "select 密码 from 用户表" + _
" where 用户表.用户名=" + "'" + _
username + "'and" + _
" 用户表.密码=" + "'" + password + "'"
rst.Open local_db, cnn
If Not (rst.BOF And rst.EOF) Then
userid = Text1.Text
Unload frmdl
'判断登陆用户是否为admin
If username = "admin" Then
mainfrm.xitong.Enabled = True '激活主窗口系统菜单
mainfrm.bdb.Enabled = True
mainfrm.Command4.Enabled = True
Else
mainfrm.xitong.Enabled = False
mainfrm.bdb.Enabled = False
mainfrm.Command4.Enabled = False
End If
frmver.Show '显示版本窗口
Else
MsgBox "您输入的密码不正确,请重新输入!", , "警告"
Text2.Text = ""
Text2.SetFocus
End If
Else
MsgBox "系统中无此用户", , "警告"
Text1.Text = ""
Text1.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -