📄 changepwd.frm
字号:
VERSION 5.00
Begin VB.Form ChangePwd
BorderStyle = 1 'Fixed Single
Caption = "修改密码"
ClientHeight = 3090
ClientLeft = 5445
ClientTop = 4260
ClientWidth = 3840
LinkTopic = "Form6"
MaxButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 3840
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 375
Left = 1920
TabIndex = 7
Top = 2280
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "修改"
Height = 375
Left = 720
TabIndex = 6
Top = 2280
Width = 975
End
Begin VB.TextBox Text3
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 5
Top = 1440
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 3
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 1
Top = 480
Width = 1215
End
Begin VB.Label Label3
Caption = "确认密码:"
Height = 255
Left = 540
TabIndex = 4
Top = 1560
Width = 960
End
Begin VB.Label Label2
Caption = "新密码:"
Height = 255
Left = 720
TabIndex = 2
Top = 1080
Width = 735
End
Begin VB.Label Label1
Caption = "旧密码:"
Height = 255
Left = 720
TabIndex = 0
Top = 600
Width = 735
End
End
Attribute VB_Name = "ChangePwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim strSQL As String
Dim strUp As String
Private Sub Command1_Click()
'MsgBox ChangePwd.Text4.Text, vbOKOnly + vbExclamation, "修改密码"
If Trim(Text2.Text) = "" And Trim(Text3.Text) = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "修改密码"
Text2.SetFocus
Text2.Text = ""
Text3.Text = ""
ElseIf Trim(Text3.Text) <> Trim(Text2.Text) Then
MsgBox "密码不一致!", vbOKOnly + vbExclamation, "修改密码"
Text2.SetFocus
Text2.Text = ""
Text3.Text = ""
Else
conn.Open ConnString
' strSQL = "select * from Users where User_ID='a'"
strSQL = "select * from Users where User_Name= " + "'" & Session_Name & "'"
strSQL = strSQL + "and User_ID='" + Text1.Text + "'"
rs.Open strSQL, conn
If rs.EOF Then
MsgBox "原始密码错误!", vbOKOnly + vbExclamation, "修改密码"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text2.Text = ""
Text3.Text = ""
Else
strUp = "update Users set User_ID='" + Text2.Text + "'where User_Name=" + "'" & Session_Name & "'"
conn.Execute strUp
MsgBox "密码修改成功", vbOKOnly, "密码修改"
'rs1.Close
'Set rs1 = Nothing
End If
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
ConnString = "Provider=SQLOLEDB.1;Persist Security Info=False;Data Source=.;Initial Catalog=txlxt;User ID=sa;Password="
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -