📄 frm_chgpwd.frm
字号:
VERSION 5.00
Begin VB.Form frm_ChgPwd
BorderStyle = 3 'Fixed Dialog
Caption = "修改密码"
ClientHeight = 1395
ClientLeft = 45
ClientTop = 330
ClientWidth = 4845
Icon = "frm_ChgPwd.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1395
ScaleWidth = 4845
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "修改密码"
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 345
Left = 3480
TabIndex = 4
Top = 720
Width = 1110
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 345
Left = 3480
TabIndex = 3
Top = 330
Width = 1110
End
Begin VB.TextBox txtNewPwdConfirm
Height = 300
IMEMode = 3 'DISABLE
Left = 1455
PasswordChar = "*"
TabIndex = 2
Top = 915
Width = 1725
End
Begin VB.TextBox txtNewPwd
Height = 300
IMEMode = 3 'DISABLE
Left = 1455
PasswordChar = "*"
TabIndex = 1
Top = 495
Width = 1725
End
Begin VB.TextBox txtOldPwd
Height = 300
IMEMode = 3 'DISABLE
Left = 1455
PasswordChar = "*"
TabIndex = 0
Top = 90
Width = 1725
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "确认密码(&F):"
Height = 180
Left = 270
TabIndex = 7
Top = 975
Width = 1080
End
Begin VB.Label lblNewPwd
AutoSize = -1 'True
Caption = "新密码(&N):"
Height = 180
Left = 270
TabIndex = 6
Top = 570
Width = 900
End
Begin VB.Label lblOldPwd
AutoSize = -1 'True
Caption = "旧密码(&O):"
Height = 180
Left = 270
TabIndex = 5
Top = 180
Width = 900
End
End
Attribute VB_Name = "frm_ChgPwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim strPwd As String, strOldPwd As String, strSql As String
On Error GoTo Er
strPwd = Trim(txtNewPwd.Text)
strOldPwd = Trim(txtOldPwd.Text)
If strPwd = Trim(txtNewPwdConfirm.Text) Then
strSql = "exec sp_password '" & strOldPwd & "','" & strPwd & "','" & CurUser & "'"
Cn.Execute strSql
MsgBox "修改密码成功!", vbExclamation, Me.Caption
Unload Me
Else
MsgBox "输入的密码不一致,请重试!", , "修改密码"
txtNewPwd.SetFocus
SendKeys "{Home}+{End}"
End If
Exit Sub
Er:
MsgBox "修改密码错误:" & Err.Number & " 来自:" & Err.Source & vbCrLf & " 详细:" & Err.Description, vbExclamation, "取数据库信息错误:" & Err.Number
End Sub
Private Sub Form_Load()
Me.Caption = Me.Tag & " - " & CurUser
End Sub
'Public Sub InitLogin()
' 'Add Or Modify Logins
' Call Cn.Execute("IF exists (select * from master..syslogins where name = '" & gstr_SysUser & "')" & vbCrLf & _
' "exec sp_password NULL ,'" & gstr_SysPwd & "','" & gstr_SysUser & "'" & _
' "else " & vbCrLf & _
' " exec sp_addlogin '" & gstr_SysUser & "','" & gstr_SysPwd & "'", , adExecuteNoRecords)
'
' 'SET The Role
' Call Cn.Execute(" exec sp_addsrvrolemember '" & gstr_SysUser & "', sysadmin ", , adExecuteNoRecords)
'End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -