📄 mima.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form mima
BorderStyle = 3 'Fixed Dialog
Caption = "更改密码"
ClientHeight = 2460
ClientLeft = 45
ClientTop = 435
ClientWidth = 3735
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2460
ScaleWidth = 3735
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text3
Height = 270
Left = 1440
TabIndex = 2
Top = 1440
Width = 1935
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2160
TabIndex = 5
Top = 1920
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 480
TabIndex = 3
Top = 1920
Width = 1095
End
Begin VB.TextBox Text2
Height = 270
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 6
TabIndex = 1
Top = 840
Width = 1935
End
Begin VB.TextBox Text1
Height = 270
Left = 1440
MaxLength = 6
TabIndex = 0
Top = 240
Width = 1935
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 3720
Top = 480
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=hotel.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=hotel.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "Users"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "新密码:"
Height = 180
Left = 360
TabIndex = 7
Top = 1485
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "旧密码:"
Height = 180
Left = 360
TabIndex = 6
Top = 885
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户名:"
Height = 180
Left = 360
TabIndex = 4
Top = 285
Width = 720
End
End
Attribute VB_Name = "mima"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim UserName As String
Dim Password As String
Static Times As Integer
If Trim(Text1.Text) = "" Or Trim(Text3.Text) = "" Or Trim(Text3.Text) = "" Then '如果没填
MsgBox "不能填空值!", vbOKOnly + vbCritical, "错误"
Text1.SetFocus
Exit Sub
End If
'打开数据库中的 Users 表
Adodc1.Refresh
'查找用户名
Adodc1.Recordset.Find "Name='" & Text1.Text & "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then '找到记录
UserName = Adodc1.Recordset!Name
Password = Adodc1.Recordset!Password
Else '没找到记录
UserName = ""
Password = ""
End If
If UserName = Text1.Text And Password = Text2.Text Then
Adodc1.Recordset!Password = Text3
Adodc1.Recordset.Update
Unload mima '关闭窗体
frmMain.Show '显示主窗体
Else
'用户名或密码不对
MsgBox "用户名或密码错误!", vbOKOnly + vbInformation, "提示"
Times = Times + 1
If Times >= 3 Then '超过三次
adoUsers.Recordset.Close '关闭数据库中的 Users 表
End '退出整个程序
End If
Text2.SetFocus '重新输入密码
End If
End Sub
Private Sub Command2_Click()
Unload mima
frmMain.Show
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -