项目属性下的LoadUserSetting
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 dr As DataRow In
DataTables("授权表").Select("用户名 = '" &
User.group & "'" )
If dr.IsNull("列名") Then
For Each t As Table In Tables
If t.DataTable.Name = dr("表名") Then
t.Visible = Not dr("不可见")
t.AllowEdit = Not dr("不可编辑")
End If
Next
Else
For Each t As Table In Tables
If t.DataTable.Name = dr("表名") Then
For Each c As Col In t.Cols
If c.Name = dr("列名") Then
c.Visible = Not
dr("不可见")
c.AllowEdit = Not
dr("不可编辑")
End If
Next
End If
Next
End If
Next
以上代码使用没问题,主要问题是有时打开项目(网络可能不稳定,如联通网接入电信网),导致Tables("授权表")不能正常加载,从而对组设置的权限没有了,该禁止的表列就失效了,请教如何才能解决这个问题(保证Tables("授权表")有效的加载在项目里,权限得到有效控制),我想问做一个内部关联表(父表),当外部授权表(子表)加载不成功后,就起启内部(父表),每次能成功加载就更新子表,可这样好吗?请教有经验的人士或各路高手。
[此贴子已经被作者于2015/8/18 10:11:40编辑过]