If e.sender.Text.Contains("[") OrElse e.sender.Text.Contains("'") OrElse e.sender.Text.Contains("*") OrElse e.sender.Text = "回车查询筛选树" Then
Return
End If
Dim Values As New List (Of String)
Dim fltstr() As String
Dim txt As String = e.sender.Text
Dim flt As String
For Each c As Col In CurrentTable.Cols
If c.DataCol.IsString AndAlso c.Name <> "拼音" Then
Values.Add(c.Name)
End If
Next
If Values.Count = 0 Then
Return
End If
txt = txt.Trim()
If txt = "" Then
flt = ""
Else
If txt.Contains(",") Then
fltstr = txt.split(",")
Dim i As Integer = InStrRev(txt,",")
Dim py As String = txt.SubString(i)
py = "'%" & py & "%'"
For Int As Integer = 0 To Values.Count - 1
If CurrentTable.Cols(Values(Int)).DataCol.IsString = False Then
Continue For
End If
For Index As Integer = 0 To fltstr.Length - 1
If Int = Index Then
flt = flt & Values(Int) & " Like '%" & fltstr(Index) & "%'" & " And "
Else
Continue For
End If
Next
Next
flt = Left(flt,flt.Length - 5)
If CurrentTable.Cols.Contains("拼音") Then
flt = flt & " Or 拼音 Like " & py
End If
Else
txt = "'%" & txt & "%'"
For Int As Integer = 0 To Values.Count - 1
If CurrentTable.Cols(Values(Int)).DataCol.IsString = False Then
Continue For
End If
flt = flt & Values(Int) & " Like " & txt & " Or "
Next
flt = Left(flt,flt.Length - 4)
If CurrentTable.Cols.Contains("拼音") Then
flt = flt & " Or 拼音 Like " & txt
End If
End If
End If
'CurrentTable.Filter = flt
msgbox(flt)
If flt > "" Then
Tables("窗口2_table1").DataTable.LoadFilter = flt
Tables("窗口2_table1").DataTable.Load
Else
Tables("窗口2_table1").DataTable.LoadFilter = " 1 = 0 "
Tables("窗口2_table1").DataTable.Load
End If