📄 frm_editpas.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_EditPas
BorderStyle = 3 'Fixed Dialog
Caption = "密码修改"
ClientHeight = 2325
ClientLeft = 45
ClientTop = 330
ClientWidth = 4110
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2325
ScaleWidth = 4110
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 2640
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3100
TabIndex = 3
Top = 1920
Width = 975
End
Begin VB.Frame Frame1
Height = 1815
Left = 50
TabIndex = 1
Top = 0
Width = 4020
Begin VB.TextBox Text5
Height = 300
Left = 1320
TabIndex = 0
Top = 240
Width = 2535
End
Begin VB.TextBox Text3
Height = 300
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 9
Top = 1320
Width = 2535
End
Begin VB.TextBox Text2
Height = 300
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 8
Top = 960
Width = 2535
End
Begin VB.TextBox Text1
Height = 300
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 7
Top = 600
Width = 2535
End
Begin VB.Label Label4
Caption = "请输入用户名"
Height = 255
Left = 120
TabIndex = 10
Top = 360
Width = 1095
End
Begin VB.Label Label3
Caption = "请确认新密码"
Height = 255
Left = 120
TabIndex = 6
Top = 1440
Width = 1095
End
Begin VB.Label Label2
Caption = "请输入新密码"
Height = 375
Left = 120
TabIndex = 5
Top = 1080
Width = 1095
End
Begin VB.Label Label1
Caption = "请输入旧密码"
Height = 375
Left = 120
TabIndex = 4
Top = 720
Width = 1215
End
End
Begin VB.CommandButton Command1
Caption = "确认"
Height = 375
Left = 2040
TabIndex = 2
Top = 1920
Width = 975
End
End
Attribute VB_Name = "frm_EditPas"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text5.Text = "" Then
MsgBox "输入不能为空!!", 48, "提示信息"
Else
'判断输入的用户名在数据库中是否存在
Adodc1.RecordSource = "select * from tb_user where user_mm ='" & Text1.Text & "' and user_name='" + Text5.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If Text2.Text <> Text3.Text Then '判断数据的密码是否正确
MsgBox "两次输入的密码不一致,请您确认后重新输入", 48, "提示信息"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Else
'如果输入正确的密码则修改密码
Set AdoRs = Cnn.Execute("UPDATE tb_user SET user_mm= '" + Text3.Text + "' where user_name='" + Text5.Text + "'")
Adodc1.Refresh
MsgBox "密码修改成功,请您记住新密码", , "信息提示"
Unload Me
End If
Else
MsgBox "没有此用户的信息,请您确认后重新输入", 48, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text5.Text = ""
Text5.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'通过代码连接数据库
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_user" '连接操作员信息数据表
Adodc1.Refresh
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '如果按下的是回车键,则光标落到文本框当中
Text2.SetFocus
Else
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '如果按下的是回车键,则光标落到文本框当中
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '如果按下的是回车键,则调用按钮单击过程
Call Command1_Click
Else
End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '如果按下的是回车键,则光标落到文本框当中
Text1.SetFocus
Else
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_Main.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -