-- 作者:long086
-- 发布时间:2019/7/23 23:35:00
-- 求助,用户权限管理
帮助的示例文件,更改用户窗口,admin 这个用户在 管理组,不允许改其他组
确定 按钮的代码
Dim UserName As String = e.Form.Controls("UserName").Value Dim UserGroup As String = e.Form.Controls("UserGroup").Value Dim PassWord As String = e.Form.Controls("PassWord").Value Dim OldUserName As String Dim Parts() As String = e.Form.Text.Split("-"c) OldUserName = Parts(Parts.Length -1) If UserName = "" OrElse UserGroup = "" Then Messagebox.show("请输入用户名和用户分组!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If Dim dr As DataRow = _UserTable.SQLFind("[Name]= \'" & OldUserName & "\'") If dr IsNot Nothing Then dr("Name") = UserName dr("Group") = UserGroup dr("Password") = PassWord dr.Save() If Forms("用户管理").Opened Then With Forms("用户管理").Controls("ListBox1") .Items(.SelectedIndex) = UserName End With End If e.Form.Close Else Messagebox.show("更改用户失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If
请问应该怎么改
此主题相关图片如下:.png

|
-- 作者:有点蓝
-- 发布时间:2019/7/24 8:51:00
--
If UserName = "" OrElse UserGroup = "" Then Messagebox.show("请输入用户名和用户分组!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End IfIf UserName = "admin" andalso UserGroup <> "管理组" Then Messagebox.show("admin必须管理组!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If
|