Foxtable(狐表)用户栏目专家坐堂 → 分页后部分数据显示有误


  共有7603人关注过本帖树形打印复制链接

主题:分页后部分数据显示有误

帅哥哟,离线,有人找我吗?
atmetmicoo
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:4155 威望:0 精华:0 注册:2012/11/26 21:54:00
分页后部分数据显示有误  发帖心情 Post By:2013/2/16 23:07:00 [显示全部帖子]

林老师,

我完全参照帮助的分页编码,可是分页后发现几个奇怪的现象,假设数据10条/页,共10页:
1.一般Loadpage为8、9、10几页时,窗口表竟然无任何数据;
2.一般loadpage为5、6、7几页时,加载的数据完全一样

因为项目较大而且启用,发不上来,需要请高手来远程看看,真心感谢啊。


图片点击可在新窗口打开查看此主题相关图片如下:分页问题.jpg
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
atmetmicoo
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:4155 威望:0 精华:0 注册:2012/11/26 21:54:00
  发帖心情 Post By:2013/2/17 9:25:00 [显示全部帖子]

林老师,界面如上图所示,代码如下:


'根据权限加载数据按钮
ClientList_BtnAll_Click

Dim filter As String
Select Case CustomerManageRead ‘全局变量-权限代码
    Case "0"
        filter = "_Identify IS Null"
    Case "1"
        filter = "SalesmanID = '" & TmpUserID & "' and PubCus = 0"
    Case "2"
        filter = "SalesDepartmentID = '" & TmpDepartmentID & "' and PubCus = 0"
    Case "3"
        filter = "SalesDepartmentID like '" & TmpDepartmentID & "%' and PubCus = 0"
    Case "4"        
        Dim s1 As String = TmpDepartmentID.SubString(0,2)
        filter = "SalesDepartmentID like '" & s1 & "%' and PubCus = 0"
    Case "5"
        filter = "PubCus = 0"
End Select
Dim filter2 As String = ""
With DataTables("DA_Customer")
    .LoadFilter = filter
End With

e.Form.Controls("TextBox1").value = TmpPagesize
Dim BtnFirst As WinForm.Button = e.Form.Controls("BtnOK")
BtnFirst.performclick()
e.Sender.Enabled = False


ClientList_BtnOK_Click

Dim TextBox1 As Integer =  e.Form.Controls("TextBox1").value
If TextBox1 = 0 Or e.Form.Controls("TextBox1").value = "" Then
    TextBox1 = tmppagesize 'tmppagesize 是分页大小的全局变量,Int型,用户自行设置,一般默认值为100
    e.Form.Controls("TextBox1").value = tmppagesize
End If
tmppagesize = TextBox1
With DataTables("Da_Customer")
    .LoadTop = tmppagesize
    .loadpage = 0
    .Load()
    e.Form.Controls("Label1").text = "第" &  .LoadPage + 1 & "/" &   .TotalPages & "页" & .DataRows.Count
    If .loadpage > 0 Then
        e.Form.Controls("BtnFirst").Enabled = True
        e.Form.Controls("Btnprevious").Enabled = True
    Else
        e.Form.Controls("BtnFirst").Enabled = False
        e.Form.Controls("Btnprevious").Enabled = False
    End If
    If .TotalPages - 1 > .loadpage Then
        e.Form.Controls("BtnNext").Enabled = True
        e.Form.Controls("BtnLast").Enabled = True
    Else
        e.Form.Controls("BtnNext").Enabled = False
        e.Form.Controls("BtnLast").Enabled = False
    End If
End With

'首页
ClientList_BtnFirst_Click

With DataTables("DA_customer")
    If .LoadPage <> 0 Then
        .LoadTop = tmppagesize
        .LoadPage = 0
        .Load()
    End If


e.Form.Controls("Label1").text = "第" & DataTables("DA_Customer").LoadPage+1 & "/" &  DataTables("DA_Customer").TotalPages & "页"

If .loadpage > 0 Then
    e.Form.Controls("BtnFirst").Enabled = True
    e.Form.Controls("Btnprevious").Enabled = True
Else
    e.Form.Controls("BtnFirst").Enabled = False
    e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages-1 > .loadpage Then
    e.Form.Controls("BtnNext").Enabled = True
    e.Form.Controls("BtnLast").Enabled = True
Else
    e.Form.Controls("BtnNext").Enabled = False
    e.Form.Controls("BtnLast").Enabled = False
End If
End With

’末页
ClientList_BtnLast_Click

With DataTables("DA_customer")
    If .LoadPage < .TotalPages - 1 Then
        .LoadPage = .TotalPages - 1
        .Load()
    End If
    e.Form.Controls("Label1").text = "第" & DataTables("DA_Customer").LoadPage+1 & "/" &  DataTables("DA_Customer").TotalPages & "页"
    If .loadpage > 0 Then
        e.Form.Controls("BtnFirst").Enabled = True
        e.Form.Controls("Btnprevious").Enabled = True
    Else
        e.Form.Controls("BtnFirst").Enabled = False
        e.Form.Controls("Btnprevious").Enabled = False
    End If
    If .TotalPages-1 > .loadpage Then
        e.Form.Controls("BtnNext").Enabled = True
        e.Form.Controls("BtnLast").Enabled = True
    Else
        e.Form.Controls("BtnNext").Enabled = False
        e.Form.Controls("BtnLast").Enabled = False
    End If
End With

‘下一页
ClientList_BtnNext_Click

With DataTables("DA_customer")
    If .LoadPage < .TotalPages - 1 Then
        .LoadPage = .LoadPage + 1
        .Load()
    End If

e.Form.Controls("Label1").text = "第" & DataTables("DA_Customer").LoadPage+1 & "/" &  DataTables("DA_Customer").TotalPages & "页"
If .loadpage > 0 Then
    e.Form.Controls("BtnFirst").Enabled = True
    e.Form.Controls("Btnprevious").Enabled = True
Else
    e.Form.Controls("BtnFirst").Enabled = False
    e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages-1 > .loadpage Then
    e.Form.Controls("BtnNext").Enabled = True
    e.Form.Controls("BtnLast").Enabled = True
Else
    e.Form.Controls("BtnNext").Enabled = False
    e.Form.Controls("BtnLast").Enabled = False
End If
End With

’上一页
ClientList_Btnprevious_Click

With DataTables("DA_customer")
    If .LoadPage > 0 Then
        .LoadPage = .LoadPage - 1
        .Load()
    End If

e.Form.Controls("Label1").text = "第" & .LoadPage+1 & "/" &  .TotalPages & "页"


If .loadpage > 0 Then
    e.Form.Controls("BtnFirst").Enabled = True
    e.Form.Controls("Btnprevious").Enabled = True
Else
    e.Form.Controls("BtnFirst").Enabled = False
    e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages-1 > .loadpage Then
    e.Form.Controls("BtnNext").Enabled = True
    e.Form.Controls("BtnLast").Enabled = True
Else
    e.Form.Controls("BtnNext").Enabled = False
    e.Form.Controls("BtnLast").Enabled = False
End If

End With

[此贴子已经被作者于2013-2-17 9:27:08编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
atmetmicoo
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:4155 威望:0 精华:0 注册:2012/11/26 21:54:00
  发帖心情 Post By:2013/2/17 11:49:00 [显示全部帖子]

谢谢林老师的热心帮助,特在此备注一下以便后人知晓:

此问题是_SortKey重复导致,如果_SortKey不重复,LoadOrder是有效的。

 回到顶部