📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form FrmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "用户登录"
ClientHeight = 2070
ClientLeft = 45
ClientTop = 540
ClientWidth = 4830
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2070
ScaleWidth = 4830
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Tag = "Login"
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 3720
TabIndex = 6
Top = 1440
Width = 735
End
Begin VB.CommandButton cmdLogin
Caption = "确认"
Height = 375
Left = 3720
TabIndex = 5
Top = 840
Width = 735
End
Begin VB.TextBox txtPassword
Height = 285
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 4
Top = 1440
Width = 1695
End
Begin VB.TextBox txtUserName
Height = 285
Left = 1440
TabIndex = 3
Top = 840
Width = 1695
End
Begin VB.Label Label3
Caption = "密 码:"
Height = 255
Left = 480
TabIndex = 2
Top = 1440
Width = 735
End
Begin VB.Label Label2
Caption = "用户名:"
Height = 255
Left = 480
TabIndex = 1
Top = 840
Width = 735
End
Begin VB.Line Line1
X1 = 240
X2 = 4560
Y1 = 600
Y2 = 600
End
Begin VB.Label Label1
Caption = "请输入图书馆管理员账号及密码以登录:"
Height = 255
Left = 240
TabIndex = 0
Top = 360
Width = 3855
End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OK As Boolean
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdLogin_Click()
'检验数据的有效性
If Trim(txtUserName.Text = "") Then
MsgBox "请输入用户名!"
txtUserName.SetFocus
Exit Sub
ElseIf Trim(txtPassword = "") Then
MsgBox "请输入密码!"
txtPassword.SetFocus
Exit Sub
Else
Dim myDbOper As New DbOperation
Dim rst As ADODB.Recordset
Dim sql As String
'建立连接
myDbOper.DB_Connect
'定义查询语句
sql = "SELECT * FROM Librarian WHERE Id='" + txtUserName + "' AND Password='" + txtPassword + "'"
Set rst = myDbOper.querySQL(sql)
If (Not rst.EOF) Then
OK = True
Me.Hide
FrmMain.Show 0
Else
MsgBox "用户名和密码错误,请重新输入."
End If
rst.Close
'关闭连接
myDbOper.DB_DisConnect
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -