Dim UserName As String = e.Form.Controls("UserName").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 {用户表} Where [用户名] = '" & UserName & "'"
dt = cmd.ExecuteReader
dr = dt.DataRows(0)
If e.Form.Controls("PassWord").Value = trim(dr("密码")) Then
_UserName = UserName
_UserGroup = dr("部门")
'//执行授权表
For Each t As Table In Tables '显示所有表和列
t.Visible = True
t.AllowEdit = True
For Each c As Col In t.Cols
c.Visible = True
c.AllowEdit = True
Next
Next
'Tables("授权表").Visible = (User.Type <> UserTypeEnum.User )
'If User.Type <> UserTypeEnum.User Then
' Return
'End If
For Each dr1 As DataRow In DataTables("授权表").Select("用户名= '" & User.Name & "'" )
If dr1.IsNull("列名") Then
For Each t As Table In Tables
If t.DataTable.Name = dr1("表名") Then
t.Visible = Not dr1("不可见")
t.AllowEdit = Not dr1("不可编辑")
End If
Next
Else
For Each t As Table In Tables
If t.DataTable.Name = dr1("表名") Then
For Each c As Col In t.Cols
If c.Name = dr1("列名") Then
c.Visible = Not dr1("不可见")
c.AllowEdit = Not dr1("不可编辑")
End If
Next
End If
Next
End If
Next
e.Form.Close
Else
Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
关键就是TRUE 和0,1的问题