以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 用户登录时密码错误 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=47668) |
-- 作者:1211zhu -- 发布时间: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 -- 发布时间:2014/3/14 14:07:00 -- 是不是数据库里的 Password有空格. If e.Form.Controls("密码").Value.trim() = dr("Password").trim() Then
|