📄 frmunupdate.frm
字号:
VERSION 5.00
Begin VB.Form frmunupdate
BorderStyle = 3 'Fixed Dialog
ClientHeight = 2055
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 3750
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 1214.162
ScaleMode = 0 'User
ScaleWidth = 3521.047
ShowInTaskbar = 0 'False
Begin VB.TextBox txtPassword1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 6
Top = 960
Width = 2325
End
Begin VB.TextBox oldpassword
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 1
Top = 240
Width = 2325
End
Begin VB.CommandButton cmdOK
Caption = "确认"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 360
TabIndex = 4
Top = 1440
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 2040
TabIndex = 5
Top = 1440
Width = 1140
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 3
Top = 600
Width = 2325
End
Begin VB.Label lblLabels
Caption = "新密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Index = 2
Left = 120
TabIndex = 7
Top = 975
Width = 1080
End
Begin VB.Label lblLabels
Caption = "旧密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Index = 0
Left = 105
TabIndex = 0
Top = 240
Width = 1080
End
Begin VB.Label lblLabels
Caption = "新密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Index = 1
Left = 105
TabIndex = 2
Top = 600
Width = 1080
End
End
Attribute VB_Name = "frmunupdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
'set the global var to false
'to denote a failed login
LoginSucceeded = False
Unload Me
End Sub
Private Sub cmdOK_Click()
'check for correct password
If Len(oldpassword) = 0 Or Len(txtPassword) = 0 Or Len(txtPassword1) = 0 Then
MsgBox "密码不能为空!", , "update"
Exit Sub
End If
If oldpassword <> nowpassword Then
MsgBox "请正确输入输入旧密码!", , "update"
oldpassword.SetFocus
Exit Sub
End If
If Trim(txtPassword) <> Trim(txtPassword1) Then
MsgBox "两次输入的新密码不一样,请查证!", , "Update"
Exit Sub
End If
Dim sqlstr As String
Dim mycon As ADODB.Connection
Dim rst As ADODB.Recordset
If Len(oldpassword) <> 0 And Len(txtPassword) <> 0 And Len(txtPassword1) <> 0 Then
Set mycon = New ADODB.Connection
mycon.ConnectionString = connstring
mycon.Open
Set rst = New ADODB.Recordset
'rst.Open "select * from use where username='909'", mycon, adOpenKeyset, adLockOptimistic
sqlstr = " UPDATE use SET [password] = '" & frmunupdate.txtPassword & "' where username = '" & username & "' " ', mycon, adOpenKeyset, adLockOptimistic
' rst.Open " select password,username from use", mycon, adOpenKeyset, adLockOptimistic
' rst.Open Trim(sqlstr), mycon, adOpenKeyset, adLockOptimistic
mycon.Execute Trim(sqlstr)
Set rst = Nothing
Set mycon = Nothing
MsgBox "密码修改成功"
nowpassword = txtPassword
End If
Unload Me
' If txtPassword = "password" Then
'place code to here to pass the
'success to the calling sub
'setting a global var is the easiest
' LoginSucceeded = True
' Me.Hide
' Else
' MsgBox "请正确输入旧密码!", , "Update"
' txtPassword.SetFocus
' SendKeys "{Home}+{End}"
'End If
End Sub
Private Sub Form_Load()
oldpassword = ""
txtPassword = ""
txtPassword1 = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -