📄 login.frm
字号:
VERSION 5.00
Begin VB.Form login
Caption = "系统登录"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdcancel
Caption = "取消"
Height = 375
Left = 2400
TabIndex = 7
Top = 2640
Width = 1095
End
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 375
Left = 1080
TabIndex = 6
Top = 2640
Width = 1095
End
Begin VB.Frame Frame1
Caption = "用户登录"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1335
Left = 720
TabIndex = 1
Top = 1080
Width = 3135
Begin VB.TextBox txtpwd
Height = 315
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 5
Top = 840
Width = 1695
End
Begin VB.TextBox Txtusrname
Height = 285
Left = 1080
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 3
Top = 840
Width = 735
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 2
Top = 360
Width = 735
End
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "图书信息管理系统"
BeginProperty Font
Name = "华文彩云"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 0
Top = 360
Width = 3615
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public n As Integer
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
Dim txtsql As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
username = ""
If Trim(Txtusrname.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Txtusrname.SetFocus
Else
txtsql = "select * from operator where username='" & Txtusrname.Text & "'"
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Txtusrname.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtpwd.Text) Then
userlevel = Trim(mrc.Fields("userlevel"))
mrc.Close
username = Trim(Txtusrname.Text)
Unload Me
FrmMain.Show
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtpwd.SetFocus
txtpwd.Text = ""
End If
End If
End If
n = n + 1
If n = 3 Then
Unload Me
End If
Exit Sub
End Sub
Private Sub Form_Load()
n = 0
End Sub
Private Sub Txtusrname_KeyPress(KeyAscii As Integer)
Call EnterToTab(KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -