Foxtable(狐表)用户栏目专家坐堂 → 自定议用户修改密码怎么老不执行


  共有3185人关注过本帖树形打印复制链接

主题:自定议用户修改密码怎么老不执行

帅哥哟,离线,有人找我吗?
策动中国
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:4 积分:113 威望:0 精华:0 注册:2013/12/15 13:09:00
自定议用户修改密码怎么老不执行  发帖心情 Post By:2013/12/20 10:59:00 [只看该作者]

Dim UserName As String = e.Form.Controls("UserName").Value
Dim UserGroup As String = e.Form.Controls("UserGroup").Value
Dim PassWord As String = e.Form.Controls("PassWord").Value
Dim OldUserName As String
Dim dt As DataTable
Dim dr As DataRow
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "Select * From {Users} Where [Name] = '" & UserName & "'"
dt = cmd.ExecuteReader
dr = dt.DataRows(0)
If e.Form.Controls("OldPassWord").Value = dr("Password") Then
cmd.CommandText = cmd.CommandText & "', [Password] = '" & Password & "' Where [Name]= '" & OldUserName & "'"
 If cmd.ExecuteNonQuery = 1 Then '返回1表示更改成功
  Messagebox.show("密码更改成功,切记新设密码!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Else
    Messagebox.show("老密码错误,更改失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/12/20 11:03:00 [只看该作者]

cmd.CommandText = "Select * From {Users} Where [Name] = '" & UserName & "'"

cmd.CommandText = cmd.CommandText & "', [Password] = '" & Password & "' Where [Name]= '" & OldUserName & "'"

加起来的意思就是

"Select * From {Users} Where [Name] = '" & UserName & "'" & "', [Password] = '" & Password & "' Where [Name]= '" & OldUserName & "'"

这是什么东东?

更新语句应该是update 才对啊 http://www.foxtable.com/help/topics/0690.htm

"UPDATE {Users} SET Password '" & Password & "' WHERE  [Name]= '" & OldUserName & "'"



 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/12/20 11:15:00 [只看该作者]

新手,一般没有必要自定义用户管理了,因为2013版内置的用户管理,也可以基于外部表了:

http://www.foxtable.com/help/topics/2723.htm

还可以自定义登陆窗口:

http://www.foxtable.com/help/topics/2729.htm

 

就是老鸟,自己写用户管理的也不多了。


 回到顶部