标题:(求助)修改密码的时候输入原密码正确为什么提示错误?
只看楼主
zylnokia
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-9-12
 问题点数:0 回复次数:4 
(求助)修改密码的时候输入原密码正确为什么提示错误?
Private Sub Command1_Click()
            On Error Resume Next
            Dim Password As String
            Dim Newpassword As String
            
            Password = Text1.Text
            Newpassword = Text2.Text
            
            Set Mydb = ExeCutesql("SELECT pass from user1 WHERE user='" & Cname & "'", Str_text)
            
            If Not Password = Mydb.Fields(0) Then
                  MsgBox "原密码输入错误!", vbOKOnly + 32, "注意"
                  Text2.Text = ""
                  Text3.Text = ""
                  Text2.SetFocus
            Else
               If Text3.Text <> Newpassword Then
                  MsgBox "你两次输入密码不一致,请重新输入!", vbOKOnly + 32, "注意"
                  Text1.SetFocus
               Else
                  ExeCutesql "UPDATE user1 SET pass= '" & Newpassword & "' where user='" & Cname & "'", ""
                  MsgBox "密码更改成功!", vbOKOnly + 64, "注意"
                  Unload Me
               End If
            End If
End Sub
搜索更多相关主题的帖子: 密码 提示 Password String 
2007-12-05 11:26
purana
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
得分:0 
Password = trim(Text1.Text)
Newpassword = trim(Text2.Text)
            
Set Mydb = ExeCutesql("SELECT pass from user1 WHERE user='" & Cname & "'", Str_text)
msgbox Mydb.Fields(0)
if Password=Mydb.Fields(0) then
这样看看.

我的msn: myfend@
2007-12-05 11:29
zylnokia
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-9-12
得分:0 
更改为以下代码,提示修改成功,但数据库里的密码没有更改。
Password = Trim(Text1.Text)
            Newpassword = Trim(Text2.Text)
            
            Set Mydb = ExeCutesql("SELECT pass from user1 WHERE user='" & Cname & "'", Str_text)
            MsgBox Mydb.Fields(0)
            If Password = Mydb.Fields(0) Then
                If Text3.Text = Newpassword Then
                  ExeCutesql "UPDATE user1 SET pass= '" & Newpassword & "' where user='" & Cname & "'", ""
                  MsgBox "密码更改成功!", vbOKOnly + 64, "注意"
                  Unload Me
                Else
               
                  MsgBox "你两次输入密码不一致,请重新输入!", vbOKOnly + 32, "注意"
                  Text1.SetFocus
                End If
            Else
                  MsgBox "原密码输入错误!", vbOKOnly + 32, "注意"
                  Text2.Text = ""
                  Text3.Text = ""
                  Text2.SetFocus
            End If
2007-12-05 12:23
purana
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
得分:0 
那估计是你ExecuteSQL过程的问题了.

我的msn: myfend@
2007-12-05 12:29
zylnokia
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-9-12
得分:0 
谢谢版主,我再找找原因
2007-12-05 14:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-190509-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.591512 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved