For Each nd In trv.AllNodes
If nd.Checked Then
Dim rts() As String = nd.FullPath.Split("\")
Dim val As String = ""
For i As Integer = 0 To rts.length - 1
If Tb1.DataTable.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 Tb1.DataTable.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 Tb1.DataTable.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 Tb1.DataTable.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
Next
Dim dt As DataTable = Vars("dt")
Dim nids As String = dt.GetComboListString("系统编号",flt)
If flt > "" AndAlso notchecked > 0 Then
Tb1.Filter = "系统编号 In ('" & nids.Replace("|","','") & "')"
Else
Tb1.Filter = (1 = 2)
End If