Dim Name As String = e.Form.Controls("Name").Value
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
cmd.C
If Name = "" Then
Messagebox.show("请选择或输入用户登录名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
cmd.CommandText = "Select * From {用户} Where [登录名] = '" & Name & "'"
dt = cmd.ExecuteReader
dr = dt.DataRows(0)
If dt.DataRows.Count = 0 Then '返回1表示更改成功
Messagebox.show("用户名输入错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
Else
If dr("禁用") = True Then
Messagebox.show("此用户已禁用,请与管理员联系!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
Else
If e.Form.Controls("PassWord").Value = dr("密码") Then
_Name = Name
_UserName = dr("用户名")
_UserGroup = dr("用户组")
_UserJS = dr("角色")
e.Form.Close
Else
Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End If
登录时输入的用户名不在用户表中,确定时出现“超出数组范围”的错误提示