📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
Caption = "登录"
ClientHeight = 2085
ClientLeft = 60
ClientTop = 450
ClientWidth = 4575
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2085
ScaleWidth = 4575
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 3240
TabIndex = 6
Top = 1440
Width = 855
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 375
Left = 480
TabIndex = 5
Top = 1440
Width = 855
End
Begin VB.Frame Frame1
Height = 1335
Left = 360
TabIndex = 0
Top = 0
Width = 3855
Begin VB.TextBox txtPSW
Appearance = 0 'Flat
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 4
Top = 720
Width = 1335
End
Begin VB.TextBox txtUsername
Appearance = 0 'Flat
Height = 375
Left = 1320
TabIndex = 3
Top = 240
Width = 1335
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 255
Left = 360
TabIndex = 2
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "登录名:"
Height = 375
Left = 360
TabIndex = 1
Top = 360
Width = 735
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
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim rsuser As New ADODB.Recordset
Dim strsql As String
If txtUsername.Text = "" Then
MsgBox "请输入登录者名姓", vbOKOnly, "提示"
txtUsername.SetFocus
Exit Sub
Else
If txtPSW.Text = "" Then
MsgBox "请输入密码", vbOKOnly, "提示"
txtPSW.SetFocus
Exit Sub
Else
' 超级登录者
If txtUsername.Text = "ZDX" And txtPSW.Text = "1111" Then
strLoginName = txtUsername.Text
Unload Me
frmBookManagement.Show
Else
strsql = "select username from users where username='" & txtUsername.Text & "' and psw='" & txtPSW.Text & "'"
rsuser.Open strsql, conLIB, adOpenStatic, adLockOptimistic
If rsuser.BOF And rsuser.BOF Then
MsgBox "登录名或密码错误,请重输入", vbOKOnly, "错误"
txtUsername.SelStart = 0
txtUsername.SelLength = Len(txtUsername.Text)
rsuser.Close
Set rsuser = Nothing
Exit Sub
Else
'数据库中存在的登录者
rsuser.Close
Set rsuser = Nothing
strLoginName = txtUsername.Text
Unload Me
frmBookManagement.Show
End If
End If
End If
End If
End Sub
Private Sub Form_Load()
'open the connection
DBConnection
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -