以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  自定议用户修改密码怎么老不执行  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=43989)

--  作者:策动中国
--  发布时间: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
--  发布时间: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 & "\'"



--  作者:狐狸爸爸
--  发布时间:2013/12/20 11:15:00
--  

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

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

还可以自定义登陆窗口:

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

 

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