📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
Caption = "登录"
ClientHeight = 4605
ClientLeft = 60
ClientTop = 345
ClientWidth = 7740
LinkTopic = "Form1"
ScaleHeight = 4605
ScaleWidth = 7740
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 3720
TabIndex = 6
Top = 2880
Width = 1215
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 375
Left = 1320
TabIndex = 5
Top = 2880
Width = 1215
End
Begin VB.TextBox txtPassword
Height = 495
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 4
Top = 2040
Width = 2655
End
Begin VB.TextBox txtUsername
Height = 495
Left = 2760
TabIndex = 3
Top = 1320
Width = 2655
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "版本提供:DD Software"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3600
TabIndex = 7
Top = 3720
Width = 3855
End
Begin VB.Label Label3
Caption = "用户密码"
Height = 375
Left = 480
TabIndex = 2
Top = 2160
Width = 1455
End
Begin VB.Label Label2
Caption = "用户名"
Height = 375
Left = 480
TabIndex = 1
Top = 1320
Width = 1455
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "学生信息管理系统"
BeginProperty Font
Name = "楷体_GB2312"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 840
TabIndex = 0
Top = 240
Width = 5775
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public OK As Boolean
'判断登陆次数
Dim miCount As Integer
Dim UserName As String
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'用来存放SQL语句
Dim txtSQl As String
'用来存放记录集对象
Dim mrc As ADODB.Recordset
'用来存放返回信息
Dim msgtext As String
UserName = ""
'判断用户名是否为空
If Trim(txtUsername = "") Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbInformation, "警告!"
txtUsername.SetFocus
Else
'查寻指定用户名记录
txtSQl = "select* from user_info where user_id='" & txtUsername.Text & "'"
'执行查询语句
Set mrc = ExecuteSQL(txtSQl, msgtext)
If mrc.EOF Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbInformation, "警告!"
txtUsername.SetFocus
Else
'判断密码是否正确
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
Me.Hide
UserName = Trim(txtUsername.Text)
Else
MsgBox "密码错误!请重新输入。", vbOKOnly + vbInformation, "系统信息!"
txtPassword = ""
txtPassword.SetFocus
End If
End If
End If
'记载密码输入次数
miCount = miCount + 1
If miCount > 3 Then
Me.Hide
End If
Exit Sub
End Sub
Private Sub form_load()
OK = False
miCount = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -