以下是引用有点蓝在2018/9/15 17:09:00的发言:
DataTables("depList").LoadFilter = "fuZhu Like '" & organFuZhu & "% ' And len(fuZhu) <= " & organFuZhu.length+3)
'' 获取登录用户单位的辅助列名称
Dim organFuZhu As String=""
Dim dr2 As DataRow
dr2 = DataTables("organList").Find("[organName] = '" & _UserOrgan & "'") '否则在单位表查找同名的单位行,将找到的行赋值给变量dr
If dr2 IsNot Nothing Then '如果找到了同名的单位行,也就是dr不是Nothing
organFuZhu = dr2("fuZhu")
End If
''设置加载条件和排序
DataTables("depList").LoadFilter = "fuZhu Like '" & organFuZhu & "%'"
DataTables("depList").LoadFilter = "fuZhu Like '" & organFuZhu & "% ' And len(fuZhu) <= " & organFuZhu.length+3
DataTables("depList").LoadTop = Nothing
DataTables("depList").load
Tables("depList").sort = "fuZhu"
''主窗口左边的筛选目录树,利用辅助列
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nd As WinForm.TreeNode
Dim dt As DataTable = DataTables("depList")
tr.StopRedraw()
tr.Nodes.Clear
For Each dr As DataRow In dt.Select("","fuZhu")
If dr.IsNull("fuZhu") = False AndAlso dr("organName") = _UserOrgan AndAlso tr.Nodes.Contains(dr("fuZhu")) = False Then
nd = tr.Nodes.Add(dr("fuZhu"),dr("organName"))
Functions.Execute("AddChildren3",nd,dt)
End If
Next
tr.ResumeRedraw()
老师,我红色那句就能把所有部门加载出来,绿色那句就一个部门也加载不上?但是逻辑上都对着了,我不懂为啥了?