Foxtable(狐表)用户栏目专家坐堂 → 自定义用户管理例子中的这个情况怎么解决?


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

主题:自定义用户管理例子中的这个情况怎么解决?

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


加好友 发短信
等级:管理员 帖子:47449 积分:251065 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2010/6/3 22:11:00 [显示全部帖子]

1、没必要允许直接输入

2、如果你一定要允许直接输入,可以在确定按钮,判断输入的用户是否存在:

 

Dim UserName As String = e.Form.Controls("UserName").Value
Dim
cmd As New SQLCommand
Dim
dt As DataTable
Dim
dr As DataRow
cmd.ConnectionName =
"User"
If
UserName = "" Then
    Messagebox.show(
"请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End
If
cmd.CommandText =
"Select * From {Users} 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("PassWord").Value = dr("Password") Then
    _UserName = UserName
    _UserGroup = dr(
"Group")
    e.Form.Close

Else

    Messagebox.show(
"密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If


 回到顶部