1、为空的,我测试没问题。请截图说明。
2、
'Functions.Execute("项目筛选树Trv_sxs_AfterCheckNode_e",e)
Dim s As String = e.Form.Controls("Chebox_sxs").Text
Dim tb1 As Table = Tables(e.Form.Name & "_Table1")
Dim dt As DataTable = lsbdt
Dim Colstr() As String
Dim qts As String() = {"'","#",""}
Dim trv As WinForm.TreeView = e.Sender
Dim flt As String = ""
Dim nd As WinForm.TreeNode
Dim pd As WinForm.TreeNode
Dim notchecked As Integer = 0
Colstr = s.split("|")
For Each nd In e.Node.AllNodes '清除子节点的选中标记
nd.Checked = False
Next
pd = e.Node.ParentNode
Do While pd IsNot Nothing '清除父节点的选中标记
pd.Checked = False
pd = pd.ParentNode
Loop
For Each nd In trv.AllNodes
If nd.Checked Then
If nd.Name = "显示所有项目" Then
Exit For
Else
Dim rts() As String = nd.FullPath.Split("\")
Dim val As String = ""
For i As Integer = 0 To rts.length - 1
If dt.DataCols(Colstr(i)).IsString Then
If rts(i) <> "空" Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " = " & qts(0) & rts(i) & qts(0)
Else
val = val & Colstr(i) & " = " & qts(0) & rts(i) & qts(0)
End If
ElseIf rts(i) = "空" Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " Is Null"
Else
val = val & Colstr(i) & " Is Null"
End If
End If
ElseIf dt.DataCols(Colstr(i)).IsDate Then
If rts(i) <> #0001-1-1 0:00:00# Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " = " & qts(1) & rts(i) & qts(1)
Else
val = val & Colstr(i) & " = " & qts(1) & rts(i) & qts(1)
End If
ElseIf rts(i) = #0001-1-1 0:00:00# Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " Is Null"
Else
val = val & Colstr(i) & " Is Null"
End If
End If
ElseIf dt.DataCols(Colstr(i)).IsNumeric Then
If rts(i) <> 0 Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " = " & qts(2) & rts(i) & qts(2)
Else
val = val & Colstr(i) & " = " & qts(2) & rts(i) & qts(2)
End If
ElseIf rts(i) = 0 Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " Is Null"
Else
val = val & Colstr(i) & " Is Null"
End If
End If
ElseIf dt.DataCols(Colstr(i)).IsBoolean Then
If rts(i) <> False Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " = " & qts(0) & True & qts(0)
Else
val = val & Colstr(i) & " = " & qts(0) & True & qts(0)
End If
ElseIf rts(i) = False Then
If val > "" Then
val = val & " And "
val = val & Colstr(i) & " = " & qts(0) & False & qts(0)
Else
val = val & Colstr(i) & " = " & qts(0) & False & qts(0)
End If
End If
End If
Next
If flt > "" Then
flt = flt & " Or (" & val & ")"
Else
flt = val
End If
notchecked + = 1
End If
End If
Next
msgbox(flt)
Dim lst As List(of String)
If flt > "" AndAlso notchecked > 0 Then
lst = lsbdt.GetValues("系统编号",flt,"idx")
Else
lst = lsbdt.GetValues("系统编号","","idx")
End If
bhlst = Nothing
bhlst = lst
lsbcnt = Nothing
lsbcnt = lst.Count
''加载第一页数据
e.Form.Strips("主菜单").Items("btnFirst").PerformClick()
''