需求:可视权限,实现以,杨刚用户登记,主窗口打开只”主页一,子页一可见,主页二,主页三,子页二,子页三为不见。
实例执行,失效,请老师帮在实例上纠正,谢谢
这样做更方便
此主题相关图片如下:qq截图20240614094729.jpg
Dim db = HySq-l.DataBaseFactory.CreateDatabase("YF123")
'Dim Sq-l2 = "selec-t * from Users"
'Dim dt2 As system.data.DataTable = db.ExecuteDataSet(Sq-l2).Tables(0)
'dt2.TableName = "Users"
'Dim t2 As Table = e.Form.Controls("Table2").Table
't2.datasource = dt2
't2.AllowEdit = True
Dim Sq-l = "selec-t * from 页面权限"
Dim dt As system.data.DataTable = db.ExecuteDataSet(Sq-l).Tables(0)
dt.TableName = "页面权限"
Dim t As Table = e.Form.Controls("Table1").Table
t.datasource = dt
t.AllowEdit = True
Msgbox(1)
下面代码执行,没报错,但失效,如何解决?
For Each dr3 As DataRow In DataTables("主界面窗口_Table1").Select("用户名 = '" & _UserName & "' And 窗口名= '" & e.Form.Name & "'")
'For Each dr3 As DataRow In DataTables("页面权限").Select("用户名 = '" & _UserName & "' And 窗口名= '" & e.Form.Name & "'")
Dim tab As WinForm.TabControl = e.Form.Controls(dr3("控件名称"))
tab.TabPages(dr3("页名")).Visible = Not dr3("不可见")
tab.TabPages(dr3("页名")).Enabled = Not dr3("不可编辑")
Next
Msgbox(2)
学会调试
msgbox("用户名 = '" & _UserName & "' And 窗口名= '" & e.Form.Name & "'")
dim drs as list(of datarow) = DataTables("主界面窗口_Table1").Select("用户名 = '" & _UserName & "' And 窗口名= '" & e.Form.Name & "'")
msgbox(drs.count)
执行后,用户名 =小李,窗口名=主界面
msgbox("用户名 = '" & _UserName & "' And 窗口名= '" & e.Form.Name & "'"),
dim drs as list(of datarow) = DataTables("主界面窗口_Table1").Select("用户名 = '" & _UserName & "' And 窗口名= '" & e.Form.Name & "'")
执行后,提示:O,
msgbox(drs.count)
要么没有加载符合条件的数据。要么数据有问题,比如有看不见的空格,回车符等
失效问题,请老师帮处理,谢谢[upload=zip,新建文件夹 (4).z
[此贴子已经被作者于2024/6/18 11:31:29编辑过]