📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "请登录"
ClientHeight = 3105
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 5655
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1834.536
ScaleMode = 0 'User
ScaleWidth = 5309.739
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame FraLogin
Caption = "登录"
Height = 1575
Left = 240
TabIndex = 1
Top = 1200
Width = 5175
Begin VB.TextBox txtPwd
Height = 345
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 5
Top = 840
Width = 1830
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 3480
TabIndex = 4
Top = 840
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 375
Left = 3480
TabIndex = 3
Top = 360
Width = 1140
End
Begin VB.TextBox txtUser
Height = 345
Left = 1425
TabIndex = 2
Top = 360
Width = 1830
End
Begin VB.Label lblLabels
Caption = "密 码(&P):"
Height = 270
Index = 1
Left = 360
TabIndex = 7
Top = 960
Width = 960
End
Begin VB.Label lblLabels
Caption = "用户名(&U):"
Height = 270
Index = 0
Left = 360
TabIndex = 6
Top = 480
Width = 1080
End
End
Begin VB.Frame FraUser
Caption = "选择身份"
Height = 615
Left = 240
TabIndex = 0
Top = 240
Width = 5175
Begin VB.OptionButton OptUserType
Caption = "学生"
Height = 255
Index = 1
Left = 2880
TabIndex = 9
Top = 240
Width = 975
End
Begin VB.OptionButton OptUserType
Caption = "教师"
Height = 255
Index = 0
Left = 1320
TabIndex = 8
Top = 240
Width = 975
End
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mnUserType As Integer
Dim micount As Integer
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim mrc As ADODB.Recordset
Dim usertxtsql As String
Dim usermsgtext As String
If Trim(txtUser.Text = "") Then
MsgBox "请输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUser.SetFocus
Exit Sub
Else
'根据不同的身份登录
Select Case mnUserType
Case 0:
usertxtsql = "select * from user_info where User_ID='" & txtUser.Text & "' and User_TYPE='" & OptUserType(0).Caption & "'"
Case 1:
usertxtsql = "select * from user_info where User_ID='" & txtUser.Text & "' and User_TYPE='" & OptUserType(1).Caption & "'"
End Select
Set mrc = ExecuteSql(usertxtsql, usermsgtext)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUser.SetFocus
Exit Sub
Else
If Trim(txtPwd.Text = "") Then
MsgBox "请输入密码!", vbOKOnly + vbExclamation, "警告"
txtPwd.SetFocus
Exit Sub
Else
usertxtsql = usertxtsql & "select * from user_info where user_PW='" & Trim(txtPwd.Text) & " '"
Set mrc = ExecuteSql(usertxtsql, usermsgtext)
If Trim(mrc.Fields(2)) = Trim(txtPwd.Text) Then
mrc.Close
Me.Hide
Else
micount = micount + 1
If micount >= 3 Then
MsgBox "输入密码3次不正确,你无权进入系统!", vbOKOnly + vbExclamation, "警告"
Me.Hide
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPwd.SetFocus
txtPwd.Text = ""
End If
Exit Sub
End If
End If
End If
End If
sys_info.Show
End Sub
Private Sub form_load()
micount = 0
OptUserType(0).Value = True
link
End Sub
Private Sub OptUserType_Click(Index As Integer)
mnUserType = Index
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -