以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  可视化授权  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=20747)

--  作者:gslxzy
--  发布时间:2012/6/18 17:31:00
--  可视化授权
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.Name & "\'" )
    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

--  作者:gslxzy
--  发布时间:2012/6/18 17:32:00
--  

用以上的代码项目重新登录时,选择表的不可见或不可编辑时不起作用是怎么回事

 


--  作者:狐狸爸爸
--  发布时间:2012/6/18 17:36:00
--  

换个位置,将代码设置在这里:

http://www.foxtable.com/help/topics/1323.htm

 


--  作者:gslxzy
--  发布时间:2012/6/18 18:14:00
--  

还是不行,另外我在菜单中的命令是Forms("项目计划").Open()
MainTable = Tables("项目计划")

是不是问题出在这里

 


--  作者:jianjingmaoyi
--  发布时间:2012/6/18 20:06:00
--  
登录用的是什么?
--  作者:gslxzy
--  发布时间:2012/6/18 20:45:00
--  
登录是按帮助中的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 {users} Where [Name] = \'" & UserName & "\'"
dt = cmd.ExecuteReader
dr = dt.DataRows(0)
If e.Form.Controls("PassWord").Value = dr("Password") Then
    _UserName = UserName
    _UserGroup = dr("Group")
    e.Form.Close
Else
    Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

--  作者:jianjingmaoyi
--  发布时间:2012/6/18 21:01:00
--  
明明自定义登录

For Each dr As DataRow In DataTables("授权表").Select("用户名 = \'" & User.Name & "\'" )   这个地方用这个?

--  作者:gslxzy
--  发布时间:2012/6/18 21:06:00
--  

那代码该怎样改啊,谢谢

 


--  作者:blackzhu
--  发布时间:2012/6/19 7:30:00
--  
For Each dr As DataRow In DataTables("授权表").Select("用户名 = \'" & _UserName & "\'" ) 
--  作者:狐狸爸爸
--  发布时间:2012/6/19 10:14:00
--  

看看这里最后面的“总结”:

http://www.foxtable.com/help/topics/2048.htm