以文本方式查看主题

-  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=143149)

--  作者:旭日生
--  发布时间:2019/11/15 9:38:00
--  同表复制行代码有错?
在编号不为空的情况下,如果卷号和年度相同,则复制已有数据的最后一行数据。感觉代码没错,但实现不了,没想明白。请版主帮看一下为什么?
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目5.foxdb


--  作者:有点蓝
--  发布时间:2019/11/15 9:57:00
--  
    Case "卷号","年度"

        Dim i As Integer
        If Integer.TryParse(e.DataRow("卷号"),i)Then
            e.DataRow("卷号") = Format(i, "00000")
        Else
            e.DataRow("卷号") = e.DataRow("卷号").PadLeft(5,"0").ToUpper()
        End If
        
        If e.DataRow.Isnull("卷号")  OrElse  e.DataRow.IsNull("年度") OrElse e.DataRow("卷号") = "00000"  Then
            e.DataRow("数量") = Nothing
            e.DataRow("日期") = Nothing
        Else
            Dim dr As DataRow = e.DataRow
            Dim fdr As DataRow = DataTables("举例测试").find("卷号 = \'" & dr("卷号") & "\' And 年度 = \'" & dr("年度") & "\' and 编号 is not null and [_Identify] <> " & dr("_Identify"),"[_Identify] desc")
            If fdr IsNot Nothing Then
                e.DataRow("数量") = fdr("数量")
                e.DataRow("日期") = fdr("日期")
            End If
        End If

--  作者:旭日生
--  发布时间:2019/11/15 10:20:00
--  
明白了。感谢蓝版!