📄 修改密码.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmmimagai
Caption = "修改密码"
ClientHeight = 3810
ClientLeft = 3480
ClientTop = 1905
ClientWidth = 5775
ForeColor = &H80000005&
LinkTopic = "Form3"
MaxButton = 0 'False
ScaleHeight = 3810
ScaleWidth = 5775
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 600
Top = 3480
Visible = 0 'False
Width = 2295
_ExtentX = 4048
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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=信息库.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息库.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select 密码 from 权限表 where 权限表.权限 like 88888888"
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.ComboBox Combo1
Height = 300
ItemData = "修改密码.frx":0000
Left = 2400
List = "修改密码.frx":000A
TabIndex = 10
Top = 840
Width = 2175
End
Begin VB.TextBox Text1
Height = 270
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "#"
TabIndex = 4
Top = 1320
Width = 2175
End
Begin VB.TextBox Text2
Height = 270
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "#"
TabIndex = 3
Top = 1800
Width = 2175
End
Begin VB.TextBox Text3
Height = 270
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "#"
TabIndex = 2
Top = 2280
Width = 2175
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 = 720
TabIndex = 1
Top = 2880
Width = 1935
End
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 = 3000
TabIndex = 0
Top = 2880
Width = 2055
End
Begin VB.Label Label1
Caption = "选择权限:"
ForeColor = &H00FF0000&
Height = 255
Left = 1080
TabIndex = 9
Top = 840
Width = 1215
End
Begin VB.Label Label2
Caption = "请输入旧密码:"
ForeColor = &H00FF0000&
Height = 255
Left = 1080
TabIndex = 8
Top = 1320
Width = 1335
End
Begin VB.Label Label3
Caption = "请输入新密码:"
ForeColor = &H00FF0000&
Height = 255
Left = 1080
TabIndex = 7
Top = 1800
Width = 1455
End
Begin VB.Label Label4
Caption = "确认新密码:"
ForeColor = &H00FF0000&
Height = 255
Left = 1080
TabIndex = 6
Top = 2280
Width = 1455
End
Begin VB.Label Label5
Caption = "欢迎使用浴馆管理系统"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 1320
TabIndex = 5
Top = 120
Width = 3255
End
End
Attribute VB_Name = "frmmimagai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim update_sql As String
Dim cnn As ADODB.Connection
Dim code_rs As ADODB.Recordset
Private Sub Command1_Click()
'定义旧密码
Dim jiu As String
'定义语句变量
Dim flag As Integer
'确认新密码变量
Dim queren As String
'新密码变量
Dim pass As String
'输入完整性
Dim sql As String
flag = 0
If Not (Text2.Text = "") And Text3.Text = "" Then
MsgBox "请您确认您的新密码!", , "提示"
Else
If Text3.Text = "" Then
MsgBox "请您输入您的新密码!", , "提示"
Else
flag = 1
End If
End If
'------------------------------------------------------
jiu = Text1.Text
pass = Text2.Text
queren = Text3.Text
If flag = 1 Then
If Not (pass = queren) Then
flag = 0
MsgBox "新密码和确认密码不同,请再次确认!", , "提示"
Else
flag = 1
End If
End If
'-------------------------------------------------------
'把修改的密码存入数据库
If flag = 1 Then
Dim rs As Recordset
Dim strquery As String
strquery = "select 密码 from 权限表 where 权限表.权限 like" + Combo1.Text
Adodc1.RecordSource = "select 权限表.密码 from 权限表 where 权限表.权限 like" + "'" + Combo1.Text + "'"
Adodc1.Refresh
Set rs = Adodc1.Recordset
If rs.EOF Then
MsgBox "aa"
End If
If Adodc1.Recordset.Fields("密码").Value = jiu Then
update_sql = " update 权限表 set 权限表.密码=" + "'" + pass + "'" + "where 权限表.权限=" + "'" + Combo1.Text + "'"
cnn.Execute update_sql
MsgBox "密码修改成功!", vbInformation, "提示"
Unload frmmimagai
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Else
MsgBox "权限有误!请重新输入用户旧密码!", vbCritical, "警告"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
End If
End Sub
Private Sub Command2_Click()
Unload frmmimagai
End Sub
Private Sub Form_Load()
Set cnn = New ADODB.Connection
Set code_rs = New ADODB.Recordset
' Dim cmdlidi As ADODB.Command
' Set cmdlidi = New ADODB.Command
'
' Dim paralidi As ADODB.Parameter
' Set paralidi = New ADODB.Parameter
'**************************************************
With cnn
.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = 信息库.mdb"
.Open
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -