Dim bm As WinForm.ComboBox = e.Form.Controls("部门")
Dim xm As WinForm.ComboBox = e.Form.Controls("姓名")
Dim zh As WinForm.TextBox = e.Form.Controls("账号")
Dim mm As WinForm.TextBox = e.Form.Controls("密码")
''判断部门账号是否一致
Dim dr As DataRow = DataTables("用户管理").Find("账号 =
'" & zh.text & "'")
'Dim dr As DataRow
= DataTables("用户管理").Find("账号 =
'" & zh.text & "' and 部门='" & bm.text & "' and 姓名='"
& xm.text & "'")
If dr Is Nothing Then
MessageBox.Show ("账号不存在, 请确认账号是否注册!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return
End If
If bm.value = dr("部门") And xm.value = dr("姓名") And zh.value = dr("账号") Then
If mm.value = dr("密码") Then
If dr("用户状态") = "停用" Then '如果前面部门或姓名只加载了启用状态的,此处不用判断
MessageBox.Show ("您的账号还未启用或已停用, 请与管理员联系!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return
End If
Forms("登录").close
MainTable = Tables("用户管理") '打开主界面表
e.Form.close
Else
MessageBox.Show ("密码错误,请重新输入!", "提示", MessageBoxButtons.OK,
MessageBoxIcon.Warning)
Return
End If
Else
MessageBox.Show ("部门,姓名,账号不一致, 请检查!", "提示", MessageBoxButtons.OK,
MessageBoxIcon.Warning)
Return
End If
将Dim dr As DataRow = DataTables("用户管理").Find("账号 =
'" & zh.text & "'")
代码换成下面这一句就好用了
Dim dr As DataRow = DataTables("用户管理").Find("账号 =
'" & zh.text & "' and 部门='" & bm.text & "' and 姓名='" & xm.text & "'")