两种方法
用追载:
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("窗口4_Table1")
tbl.DataTable.AppendLoad("条件")
If txt = "" Then
tbl.Filter =" leveal=2 and deleted=0 and isstop=0"
tbl.Sort = "pfullname desc,Standard desc,Unit1 desc"
Else
txt = "'*" & txt & "*'"
tbl.filter = "(pfullname Like " & txt & " Or Standard Like " & txt & " Or Unit1 Like " & txt & ") and (leveal=2 and deleted=0 and isstop=0)"
tbl.Sort = "pfullname desc,Standard desc,Unit1 desc"
End If
用加载:
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("窗口4_Table1")
Dim Filter As string
Dim Sort AS string
If txt = "" Then
Filter =" leveal=2 and deleted=0 and isstop=0"
Sort = "pfullname desc,Standard desc,Unit1 desc"
Else
txt = "'%" & txt & "%'" '这里用%,不是*
filter = "(pfullname Like " & txt & " Or Standard Like " & txt & " Or Unit1 Like " & txt & ") and (leveal=2 and deleted=0 and isstop=0)"
Sort = "pfullname desc,Standard desc,Unit1 desc"
End If
tbl.DataTable.LoadFilter = Filter
tbl.DataTable.Load
tbl.sort = sort