Foxtable(狐表)用户栏目专家坐堂 → 用户登录时密码错误


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

主题:用户登录时密码错误

美女呀,离线,留言给我吧!
1211zhu
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:9 积分:142 威望:0 精华:0 注册:2014/3/12 15:32:00
用户登录时密码错误  发帖心情 Post By:2014/3/14 14:05:00 [只看该作者]

Dim UserName As String = e.Form.Controls("用户名").Value
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
cmd.C
If UserName = ""  Then
    Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If
cmd.CommandText = "Select * From {User} Where [Name] = '" & UserName & "'"
dt = cmd.ExecuteReader
If dt.DataRows.Count = 0 Then
    Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If
dr = dt.DataRows(0)

If  e.Form.Controls("密码").Value = dr("Password") Then
    _UserName = UserName
    _UserGroup = dr("Groupname")
    e.Form.Close
Else
    Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If


输入用户名和密码,登录时,怎么总是提示密码错误

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


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

是不是数据库里的 Password有空格.

If  e.Form.Controls("密码").Value.trim() = dr("Password").trim() Then

 回到顶部