📄 form_login.frm
字号:
VERSION 5.00
Begin VB.Form Form_Login
Caption = "用户登录"
ClientHeight = 4530
ClientLeft = 60
ClientTop = 450
ClientWidth = 6420
LinkTopic = "Form1"
Picture = "Form_Login.frx":0000
ScaleHeight = 4530
ScaleWidth = 6420
Begin VB.ComboBox Combo_name
Height = 300
Left = 1410
TabIndex = 7
Top = 2010
Width = 1605
End
Begin VB.ComboBox Combo_SF
Height = 300
ItemData = "Form_Login.frx":E150
Left = 1410
List = "Form_Login.frx":E152
TabIndex = 6
Top = 1500
Width = 1605
End
Begin VB.CommandButton Command_Exit
Caption = "退出"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1890
TabIndex = 5
Top = 3090
Width = 975
End
Begin VB.CommandButton Command_Login
Caption = "登录"
Default = -1 'True
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 630
TabIndex = 4
Top = 3090
Width = 975
End
Begin VB.TextBox Text_PWd
Height = 300
IMEMode = 3 'DISABLE
Left = 1410
PasswordChar = "*"
TabIndex = 2
Top = 2520
Width = 1605
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H80000013&
Caption = "请输入用户名与密码"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 315
Left = 360
TabIndex = 8
Top = 720
Width = 2985
End
Begin VB.Label Label3
Alignment = 2 'Center
BackColor = &H80000013&
Caption = "身份"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 480
TabIndex = 3
Top = 1530
Width = 735
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000013&
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 480
TabIndex = 1
Top = 2550
Width = 735
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H80000013&
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 480
TabIndex = 0
Top = 2040
Width = 735
End
End
Attribute VB_Name = "Form_Login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Rs_pri As New ADODB.Recordset
Dim Rs_users As New ADODB.Recordset
Private Sub Combo_SF_Click()
Dim str1 As String
pri = Combo_SF.Text
str1 = "select username from users where privilege='" & pri & "'"
With Rs_users
.Open str1, Con, adOpenDynamic, adLockPessimistic
Combo_name.Clear
Do While Not .EOF
Combo_name.AddItem (.Fields("username"))
.MoveNext
Loop
.Close
Combo_name.ListIndex = 0
End With
End Sub
Private Sub Command_Exit_Click()
ret = MsgBox("是否退出出卷系统!", 4 + 32 + 256 + 4096, "确定退出")
If ret = vbYes Then
End
Else
Form_Login.Show
End If
End Sub
Private Sub Command_Login_Click()
Dim id As String, pw As String
id = Combo_name.Text
pw = "Select pwd From users Where username='" & id & "'"
With Rs_users
.Open pw, Con, adOpenDynamic, adLockPessimistic
If Text_pwd.Text = .Fields("pwd") Then
Text_pwd.Text = ""
Form_Login.Hide
If Combo_SF = "出卷人" Then
Form_CJXT.Show
ElseIf Combo_SF = "审核人" Then
Form_CJXTSH.Show
Else: Combo_SF = "管理员"
Form_CJXTGL.Show
End If
Else
ret = MsgBox("用户名或密码错误,请重新输入!", 0 + 48 + 0 + 0, "错误提示")
End If
.Close
End With
End Sub
Private Sub Form_Load()
Height = 5000
Width = 6500
Top = 2800
Left = 6000
Call Module1.Connect
Dim str As String
str = "select distinct privilege from users"
With Rs_pri
.Open str, Con, adOpenDynamic, adLockPessimistic
Do While Not .EOF
Combo_SF.AddItem (.Fields("privilege"))
.MoveNext
Loop
.Close
Combo_SF.ListIndex = 0
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -