📄 login.frm
字号:
VERSION 5.00
Begin VB.Form login
Caption = "图书馆管理系统用户登录"
ClientHeight = 4095
ClientLeft = 3765
ClientTop = 3975
ClientWidth = 6465
ForeColor = &H8000000F&
LinkTopic = "Form2"
MaxButton = 0 'False
ScaleHeight = 4095
ScaleWidth = 6465
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4080
TabIndex = 5
Top = 3240
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1170
TabIndex = 4
Top = 3240
Width = 1095
End
Begin VB.TextBox txtpwd
Height = 375
IMEMode = 3 'DISABLE
Left = 2760
PasswordChar = "*"
TabIndex = 3
Top = 2160
Width = 2055
End
Begin VB.TextBox txtuser
Height = 375
Left = 2760
TabIndex = 2
Top = 1230
Width = 2055
End
Begin VB.Label Label3
Caption = "欢迎登陆图书管理系统"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 870
TabIndex = 6
Top = 360
Width = 4455
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1230
TabIndex = 1
Top = 2310
Width = 600
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1110
TabIndex = 0
Top = 1290
Width = 840
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cnt As Integer '记录确定次数
Private Sub Command1_Click()
Dim sql As String
Dim rs_login As New ADODB.Recordset
If Trim(txtuser.Text) = "" Then '判断输入的用户名是否为空
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
txtuser.SetFocus
Else
sql = "select * from 系统管理 where 用户名='" & txtuser.Text & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = True Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
txtuser.SetFocus
Else '检验密码是否正确
If Trim(rs_login.Fields(1)) = Trim(txtpwd.Text) Then
userID = txtuser.Text
userpow = rs_login.Fields(2)
rs_login.Close
Unload Me
Form1.Show
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
txtpwd.SetFocus
End If
End If
End If
cnt = cnt + 1
If cnt = 3 Then
Unload Me
End If
Exit Sub
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim connectionstring As String
connectionstring = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=book"
conn.Open connectionstring
cnt = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -