Dim txt As String = e.Form.Controls("过滤值").Text Dim tbl As DataTable = DataTables("tabDIYTable24") Dim sxxm As String = e.Form.Controls("过滤项目").text Dim ftxt As String Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") Dim tb As WinForm.TreeNode = trv.SelectedNode Dim i As Integer = tb.Level If txt = "" And tb.Text <> "所有分类" And i = 0 Then ftxt = "F128" & " = '" & tb.Text & "'" Else If txt = "" And tb.Text <> "所有分类" And i = 1 Then ftxt = "F128" & " = '" & tb.ParentNode.Text & "' and F126" & " = '" & tb.Text & "'" Else If txt <> "" And tb.Text <> "所有分类" And i = 0 Then txt = "'%" & txt & "%'" For Each cl As DataCol In DataTables("tabDIYTable24").DataCols If cl.Caption = sxxm Then ftxt = cl.Name & " Like " & txt & " and F128" & " = '" & tb.Text & "'" End If Next Else If txt <> "" And tb.Text <> "所有分类" And i = 1 Then txt = "'%" & txt & "%'" For Each cl As DataCol In DataTables("tabDIYTable24").DataCols If cl.Caption = sxxm Then ftxt = cl.Name & " Like " & txt & " and F128" & " = '" & tb.ParentNode.Text & "' and F126" & " = '" & tb.Text & "'" End If Next Else If txt <> "" And tb.Text = "所有分类" Then txt = "'%" & txt & "%'" For Each cl As DataCol In DataTables("tabDIYTable24").DataCols If cl.Caption = sxxm Then ftxt = cl.Name & " Like " & txt End If Next Else ftxt = "" End If With DataTables("tabDIYTable24") .LoadFilter = ftxt '一定要清除加载条件 .LoadTop = 15 .LoadPage = 0 .Load() End With
|