以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  狐狸爸爸,这里我用的SQL server中的表,表的不可见用truej是不是就不对了,那用SQL server的0,1怎么不处理  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=9799)

--  作者:dd-zdh
--  发布时间:2011/5/8 14:57:00
--  狐狸爸爸,这里我用的SQL server中的表,表的不可见用truej是不是就不对了,那用SQL server的0,1怎么不处理

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的问题


--  作者:dd-zdh
--  发布时间:2011/5/8 14:59:00
--  

t.Visible = Not dr1("不可见")
t.AllowEdit = Not dr1("不可编辑")

 

c.Visible = Not dr1("不可见")
                       

c.AllowEdit = Not dr1("不可编辑")

这四句话是重点,不会处理


--  作者:狐狸爸爸
--  发布时间:2011/5/8 16:41:00
--  

到了FoxTable,就都是True和False了,没有0和1了。

出于稳妥考虑,你将用户表直接加载到foxtable,看看相关列的值,到底是True和False,还是0和1.