以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教分页加载 排序的问题?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=100955)

--  作者:jswjyjf
--  发布时间:2017/5/22 14:11:00
--  请教分页加载 排序的问题?
我有一个进货单 现在我用以下代码实现分页加载了 并按单据号 排序,但是结果排序没有按照单据号来了 ,不知道什么原因?代码如下

Dim Filter As String = "1=1"
With e.Form.Controls("khname")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "供应商名称 = \'" & .Value & "\'"
    End If

End With
With e.Form.Controls("ckname")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "仓库 = \'" & .Value & "\'"
    End If

End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >=\'" & .Value & "\'"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <=\'" & .Value & "\'"
    End If
End With
If e.Form.Controls("rdo1").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态=\'已审核\'"
End If
If e.Form.Controls("rdo2").Checked = True
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "单据状态<>\'已审核\' or 单据状态 is null"
End If
With DataTables("进货单")
  .LoadFilter = ""   
 .LoadFilter = filter
  .LoadPage = 0 \'加载第一页
.LoadOver="_Identify"
.LoadOrder = "单据号"
  .LoadTop =60  \'每页60行
  .Load()
  e.Form.Controls("TextBox1").Value = 1 & "/" & .TotalPages
End With
Tables("进货单").sort="单据号"
Dim hjsl,hjje As Double
hjsl=DataTables("进货单").sqlcompute("sum(数量)",filter)
hjje=DataTables("进货单").sqlcompute("sum(金额)",filter)
\'hjsl=DataTables("销售单").sqlcompute("count([_Identify])",filter)
e.Form.Controls("NumericComboBox1").value=hjsl
e.Form.Controls("NumericComboBox2").value=hjje
If Tables("进货单").rows.count=0
    Tables("进货单").GrandTotal = False
Else
    Tables("进货单").Cols("金额").GrandTotal = True
    Tables("进货单").GrandTotal = True \'显示合计模式
End If

--  作者:有点色
--  发布时间:2017/5/22 14:45:00
--  

 要这样设置

 

.LoadOver = "单据号"
.LoadOrder = "单据号"

--  作者:jswjyjf
--  发布时间:2017/5/23 9:47:00
--  还是没有变化
还是没有变化

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20170523094701.png
图片点击可在新窗口打开查看



[此贴子已经被作者于2017/5/23 9:49:42编辑过]

--  作者:有点色
--  发布时间:2017/5/23 11:48:00
--  

 你现在是加载的数据不正确,还是说显示的时候排序不正确?

 

 你最后写代码排序一下试试 Tables("进货单").sort="单据号"