📄 login.frm
字号:
VERSION 5.00
Begin VB.Form login
BackColor = &H00FFFFC0&
Caption = "登录仓库管理系统"
ClientHeight = 3450
ClientLeft = 60
ClientTop = 345
ClientWidth = 4935
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3450
ScaleWidth = 4935
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00FFFFC0&
Caption = "登录"
Height = 1815
Left = 600
TabIndex = 5
Top = 240
Width = 3495
Begin VB.TextBox txtuser
Height = 285
Left = 1200
TabIndex = 7
Top = 480
Width = 1575
End
Begin VB.TextBox txtpwd
Height = 285
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 6
Top = 1080
Width = 1575
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "用户名"
Height = 195
Left = 360
TabIndex = 9
Top = 480
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "密 码"
Height = 180
Left = 360
TabIndex = 8
Top = 1080
Width = 450
End
End
Begin VB.Timer Timer1
Interval = 100
Left = 240
Top = 2880
End
Begin VB.PictureBox Adodc1
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 330
Left = 1560
ScaleHeight = 270
ScaleWidth = 1395
TabIndex = 2
Top = 2520
Visible = 0 'False
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 1
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 720
TabIndex = 0
Top = 2160
Width = 1095
End
Begin VB.Line Line1
X1 = 0
X2 = 4920
Y1 = 2880
Y2 = 2880
End
Begin VB.Label Label4
BackColor = &H00FFFFC0&
Height = 375
Left = 2760
TabIndex = 4
Top = 3000
Width = 975
End
Begin VB.Label Label3
BackColor = &H00FFFFC0&
Height = 375
Left = 3840
TabIndex = 3
Top = 3000
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(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
MDIForm1.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=Microsoft.Jet.oledb.4.0;" & _
"data source=cangku.mdb"
conn.Open connectionstring
cnt = 0
End Sub
Private Sub Timer1_Timer()
Label3.Caption = Time
Label4.Caption = Date
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -