1、你后台access/sqlserver数据库,有这个表嘛?【应付款按供应商年汇总】
2、如果你后台没有这个表,但项目里面有这个表(临时表、查询并),代码改成这样
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(datatables("应付款按供应商年汇总"), "所属客户名称|产品图号规格")
trv.Nodes.Insert("显示所有行",0)
For Each dr As DataRow In DataTables("授权表").Select("用户名 = '" & User.Name & "' and 窗口名 = '" & e.Form.Name & "'")
Dim ctls() As String = dr("按钮名").split(",")
For Each c As String In ctls
e.Form.Controls(c).Visible = not dr("不可见")
e.Form.Controls(c).Enabled = not dr("不可编辑")
Next
Next
Dim dr1 As DataRow = DataTables("列设置").sqlFind("表名 = '应付款按供应商年汇总' and 用户名 = '" & user.Name & "'")
Dim str As String
If dr1 IsNot Nothing Then
str = dr1("设置")
Tables("应付款按供应商年汇总").SetColVisibleWidth(str)
Else
Tables("应付款按供应商年汇总").SetColVisibleWidth(Tables("应付款按供应商年汇总").GetColVisibleWidth())
End If