试试改成这样
Dim dr As DataRow
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 '如果是普通用户登录,根据不同的用户来设定权限
For Each dr In DataTables("授权表").Select("用户名 = '" & User.Name & "'" )
If dr.IsNull("列名") Then
Tables(dr("表名")).Visible = not dr("不可见")
Tables(dr("表名")).AllowEdit = dr("可编辑")
Else
Tables(dr("表名")).Cols(dr("列名")).Visible = not dr("不可见")
Tables(dr("表名")).Cols(dr("列名")).AllowEdit =dr("可编辑")
End If
Next
End If