替换掉您的代码:
Dim s As String = e.Node.FullPath
Dim Values() As String
Values = s.split("\")
Dim Filter As String
If Values.Length = 1
Filter = ""
Else
If Values(0) = "按设备标识"
Filter = "[设备标识] = '" & Values(1) & "'"
End If
If Values(0) = "按设备类型"
Filter = "[设备大类型] = '" & Values(1) & "'"
If e.Node.Level > 1
If Values(2) IsNot Nothing
Filter = Filter & " and [设备小类型] = '" & Values(2) & "'"
End If
End If
End If
If Values(0) = "按部门"
Filter = "[所在部门] like '" & Values(1) & "*'"
If e.Node.Level > 1
If Values(2) IsNot Nothing
Dim dr As DataRow = DataTables("设备表").find("[所在部门] = '" & Values(1) & "\" & Values(2) & "'")
If dr IsNot Nothing
Filter ="[所在部门] = '" & Values(1) & "\" & Values(2) & "'"
Else
dr = DataTables("设备表").find("[所在部门] = '" & Values(1) & "' and [安装地点] = '" & Values(2) & "'")
If dr IsNot Nothing
Filter = "[所在部门] = '" & Values(1) & "' and [安装地点] = '" & Values(2) & "'"
End If
End If
End If
End If
End If
End If
Tables("设备表").Filter = Filter