以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助,上一页的内部函数编写  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=35012)

--  作者:晕了快扶我
--  发布时间:2013/6/21 16:14:00
--  求助,上一页的内部函数编写

Dim cmd As new sqlcommand
cmd. c
cmd.commandtext = "select count(*) from {销售出库单主表}"
Dim count As Integer = cmd.ExecuteScalar
With DataTables("销售出库单主表")
    If .LoadPage > 0 Then
        .LoadPage = .LoadPage - 1
        .Load()
Else
.LoadPage = 0
MessageBox.Show("已是第一页!","提示!")
    End If
e.Form.Controls("页码信息").Text= "共[" & .TotalPages & "] 页 ,当前为第[" & .LoadPage+1 & "]页,共[" & count & "]条数据"
End With
If DataTables("销售出库单主表").DataRows.Count = 0 Then \'如果订单表没有数据
    DataTables("销售出库单子表").LoadFilter = "_Identify Is Null" \'不加载订单明细
Else
    Dim ids As String
    For Each dr As DataRow In DataTables("销售出库单主表").DataRows
        ids = ids & ",\'" & dr("出库单号") & "\'"
    Next
    ids= ids.Trim(",")
    DataTables("销售出库单子表").LoadFilter = "出库单号 In (" & ids & ")"
End If
DataTables("销售出库单子表").Load()

以上是普通代码

=======================================

Dim tbn As String = Args(0)\'主表名
Dim tbn1 As String = Args(1)\'子表名
Dim cn As String = Args(2)\'关联列名
Dim fmn As String = Args(3)\'窗口名
Dim cmd As new sqlcommand
cmd. c
cmd.commandtext = "select count(*) from {" & tbn & "}"
Dim count As Integer = cmd.ExecuteScalar
With DataTables(tbn)
    If .LoadPage < .TotalPages - 1 Then
        .LoadPage = .LoadPage + 1
        .Load()
    Else
        .LoadPage = .TotalPages -1
        MessageBox.Show("已是最后一页!","提示")
    End If
    \'e.Form.Controls("页码信息").Text= "共[" & .TotalPages & "] 页 ,当前为第[" & .LoadPage+1 & "]页,共[" & count & "]条数据"
    Forms(fmn).Controls("页码信息").Text= "共[" & .TotalPages & "] 页 ,当前为第[" & .LoadPage+1 & "]页,共[" & count & "]条数据"
End With
If DataTables(tbn).DataRows.Count = 0 Then \'如果订单表没有数据
    DataTables(tbn1).LoadFilter = "_Identify Is Null" \'不加载订单明细
Else
    Dim ids As String
    For Each dr As DataRow In DataTables(tbn).DataRows
        ids = ids & ",\'" & dr(cn) & "\'"
    Next
    ids= ids.Trim(",")
    DataTables(tbn1).LoadFilter = "cn In (" & ids & ")"
End If
DataTables(tbn1).Load()
Return Nothing

============以上是改造成的内部函数

Functions.Execute("上一页","销售出库单主表","销售出库单子表","出库单号","销售出库单") \'这个是按钮代码

 

 

错误提示是 列名 CN不存在,标红的地方CN应该有问题,但是不知道如何改动,求解


--  作者:Bin
--  发布时间:2013/6/21 16:20:00
--  
 DataTables(tbn1).LoadFilter = cn & " In (" & ids & ")"
--  作者:晕了快扶我
--  发布时间:2013/6/21 16:30:00
--  
以下是引用Bin在2013-6-21 16:20:00的发言:
 DataTables(tbn1).LoadFilter = cn & " In (" & ids & ")"

TKS!