📄 login.frm
字号:
VERSION 5.00
Begin VB.Form login
Caption = "登录"
ClientHeight = 3075
ClientLeft = 60
ClientTop = 465
ClientWidth = 5280
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3075
ScaleWidth = 5280
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 495
Left = 2640
TabIndex = 5
Top = 1680
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "登 录"
Height = 495
Left = 1080
TabIndex = 4
Top = 1680
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 2160
PasswordChar = "*"
TabIndex = 3
Top = 960
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 2160
TabIndex = 2
Top = 360
Width = 1575
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 375
Left = 1080
TabIndex = 1
Top = 1080
Width = 855
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 375
Left = 1080
TabIndex = 0
Top = 480
Width = 855
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(Text1.Text) = "" Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Else
sql = "select * from 密码表 where 用户名='" & Text1.Text & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockOptimistic
If rs_login.EOF = True Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Else
If Trim(rs_login.Fields(1)) = Trim(Text2.Text) Then
userID = Text1.Text
userpow = rs_login.Fields(2)
rs_login.Close
Formfrm.Show
Me.Hide
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
Text2.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
Unload Formfrm
End Sub
Private Sub Form_Load()
Dim connectionString As String
connectionString = "provider=Microsoft.Jet.oledb.4.0;" & _
"data source=F:\系统制作\图书管理系统1\tushu.mdb"
conn.Open connectionString
cnt = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -