For Each t As Table In Tables
t.Visible = False
For Each c As col In t.Cols
c.Visible = False
c.AllowEdit = False
Next
Next
Forms("登录窗口").Show()
Dim roles() As String = _userGroup.Split(",")
For Each role As String In roles
Dim drs As List(Of DataRow) = DataTables("权限").Select("可见 = '" & role & "' or 可见 like '" & role & ",*' or 可见 like '*," & role & ",*' Or 可见 like '*," & role & "'")
For Each dr As DataRow In drs
If dr.Isnull("表名") AndAlso dr.Isnull("列名") Then
For Each t As Table In Tables
t.Visible = True
Next
Else If dr.isnull("列名") Then
Tables(dr("表名")).Visible = True
For Each c As col In Tables(dr("表名")).Cols
c.Visible = True
Next
Else
Tables(dr("表名")).Visible = True
For Each c As col In Tables(dr("表名")).Cols
If dr("列名") = c.name OrElse dr("列名") Like c.name & ",*" OrElse dr("列名") Like "*," & c.name & ",*" OrElse dr("列名") Like "*," & c.name Then
c.Visible = True
End If
Next
End If
Next
drs = DataTables("权限").Select("可编辑 = '" & role & "' or 可编辑 like '" & role & ",*' or 可编辑 like '*," & role & ",*' Or 可编辑 like '*," & role & "'")
For Each dr As DataRow In drs
If dr.Isnull("表名") AndAlso dr.Isnull("列名") Then
For Each t As Table In Tables
t.Visible = True
t.AllowEdit = True
Next
Else If dr.isnull("列名") Then
Tables(dr("表名")).Visible = True
For Each c As col In Tables(dr("表名")).Cols
c.Visible = True
c.AllowEdit = True
Next
Else
Tables(dr("表名")).Visible = True
For Each c As col In Tables(dr("表名")).Cols
If dr("列名") = c.name OrElse dr("列名") Like c.name & ",*" OrElse dr("列名") Like "*," & c.name & ",*" OrElse dr("列名") Like "*," & c.name Then
c.Visible = True
c.AllowEdit = True
End If
Next
End If
Next
Next