Foxtable(狐表)用户栏目专家坐堂 → datacolchanged报错


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

主题:datacolchanged报错

美女呀,离线,留言给我吧!
lfz123
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:526 积分:4566 威望:0 精华:0 注册:2018/3/24 18:04:00
datacolchanged报错  发帖心情 Post By:2019/2/11 11:40:00 [只看该作者]

报错提示: 麻烦老师帮我看下! 其他功能都已经实现,就是会有这个报错,但不影响结果

图片点击可在新窗口打开查看此主题相关图片如下:错误提示.png
图片点击可在新窗口打开查看

我在凭证明细的DataColChanged事件中写了如下代码:

If e.DataCol.name = "科目代码" Then

    If e.DataRow.IsNull("科目代码") Then

        e.DataRow("会计科目_一级科目") = ""

        e.DataRow("会计科目_明细科目") = ""

    Else

        Dim str As String = e.DataRow("科目代码")

        If str.Length = 4 Then

            Dim dr As DataRow = DataTables("会计科目").find("科目代码 = '"& e.datarow("科目代码") & "'")

            e.DataRow("会计科目_一级科目") = dr("科目名称")

            e.DataRow("会计科目_明细科目") = ""

        Else

            Dim str1 As String = str.SubString(0,4)

            Dim dr1 As DataRow = DataTables("会计科目").find("科目代码 = '"& str1 & "'")

            e.DataRow("会计科目_一级科目") = dr1("科目名称")

            Dim dr2 As DataRow = DataTables("会计科目").find("科目代码 = '"& str & "'")

            e.DataRow("会计科目_明细科目") = dr2("科目名称")

        End If

    End If

End If


在窗口的按钮中写了如下代码:

Dim t As Table =  Tables("凭证.凭证明细")

t.AddNew(2)

t.Rows(0)("科目代码") = "1211001"

t.Rows(1)("科目代码") = "217100101"

Dim str As String = Forms("凭证录入").Controls("lb凭证ID").text

Dim dt As DataTable = Tables("进项piao_table1").DataTable

For Each id As String In dt.GetValues("科目代码","凭证ID = '"& str & "'")

    Dim r As Row = Tables("凭证.凭证明细").AddNew()

    r("科目代码") = id

    r("贷方金额") = dt.Compute("sum(fa piao金额)","科目代码= '"& id & "'and 凭证ID = '"& str & "'")

    Dim dr As DataRow = dt.find("科目代码= '"& id & "'and 凭证ID = '"& str & "'")

    r("摘要") = dr("销方名称").Substring(0,6) & "购:" & dr("fa piao摘要")

Next


t.Rows(0)("借方金额") = dt.Compute("sum(金额)","凭证ID = '"& str & "'")

t.Rows(1)("借方金额") = dt.Compute("sum(税额)","凭证ID = '"& str & "'")


Dim s As String = dt.GetComboListString("fa piao摘要","凭证ID = '"& str & "'")

s = s.Replace("|"," ")

t.Rows(0)("摘要") = "购:" & s 

t.Rows(1)("摘要") = "进项税:" & s


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/2/11 11:51:00 [只看该作者]

If e.DataCol.name = "科目代码" Then    
    If e.DataRow.IsNull("科目代码") Then
       
        e.DataRow("会计科目_一级科目") = ""
       
        e.DataRow("会计科目_明细科目") = ""
       
    Else
       
        Dim str As String = e.DataRow("科目代码")
       
        If str.Length = 4 Then
           
            Dim dr As DataRow = DataTables("会计科目").find("科目代码 = '"& e.datarow("科目代码") & "'")
            If dr IsNot Nothing Then
                e.DataRow("会计科目_一级科目") = dr("科目名称")
            End If
            e.DataRow("会计科目_明细科目") = ""
           
        Else
           
            Dim str1 As String = str.SubString(0,4)
           
            Dim dr1 As DataRow = DataTables("会计科目").find("科目代码 = '"& str1 & "'")
            If dr1 IsNot Nothing Then
                e.DataRow("会计科目_一级科目") = dr1("科目名称")
            End If
            Dim dr2 As DataRow = DataTables("会计科目").find("科目代码 = '"& str & "'")
            If dr2 IsNot Nothing Then
                e.DataRow("会计科目_明细科目") = dr2("科目名称")
            End If
        End If        
    End If   
End If

 回到顶部
美女呀,离线,留言给我吧!
lfz123
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:526 积分:4566 威望:0 精华:0 注册:2018/3/24 18:04:00
  发帖心情 Post By:2019/2/11 12:22:00 [只看该作者]

知道了,知道了,老师视频里面也讲过,好像有find,都需要做这个条件判断,我忘记了

 回到顶部