以文本方式查看主题

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

--  作者:爱相随
--  发布时间:2016/3/10 16:17:00
--  代码问题
If e.DataCol.Name = "分项名称" Then 
   Dim filter4 As String = "分项名称 = \'" & e.DataRow("分项名称")  & "\' And 年度 = \'" & e.DataRow("年度") & "\'And 月份 = \'" & e.DataRow("月份") & "\'"
    e.DataRow("本月1") = DataTables("FKB2").Compute("sum(YFKJE)",filter4 ) - DataTables("FKB2").Compute("sum(YFKJE)",filter4 & " and  FYDL = \'前期费用\'") + DataTables("FKB2").Compute("sum(YFKJE)",filter4 & " and  FYDL = \'测绘\'") +DataTables("FKB2").Compute("sum(YFKJE)",filter4 & " and  FYDL = \'待待费用(开发间接费)\'")    
    e.DataRow("本月3") = DataTables("FKB2").Compute("sum(YFKJE)",filter4 & " and  FYDL = \'前期费用\'") + DataTables("FKB2").Compute("sum(YFKJE)",filter4 & " and  FYDL = \'测绘\'") +DataTables("FKB2").Compute("sum(YFKJE)",filter4 & " and  FYDL = \'待待费用(开发间接费)\'")    
End If

老师,这段代码运行没有提示错。但后面的贷码我是在前面代码复制后修改的,运行提示如下错误

Foxtable 版本:2016.3.9.1
错误所在事件:表,投资表, DataColChanged
详细错误信息:
Exception has been thrown by the target of an invocation.
Cannot find column [月份].

 

修改的代码如下:

If e.DataCol.Name = "XMBM" Then
   Dim filter4 As String = "XMBM = \'" & e.DataRow("XMBM")  & "\' And 年度 = \'" & e.DataRow("年度") & "\'And 月份 = \'" & e.DataRow("月份") & "\'"
      e.DataRow("本月拔款") = DataTables("CZBK2").Compute("sum(BKJE)",filter4 )
      e.DataRow("本月投入资金") = DataTables("FKB2").Compute("sum(YFKJE)",filter4 )
      e.DataRow("本月国开行") = DataTables("DKFKB").Compute("sum(XFJE)",filter4 )
      
End If

 

我的理解运行错误提示的意思是在“投资表”中没有找到[月份]这列,但实际上是有的,而名称完全相同。请老师指导。

 



--  作者:爱相随
--  发布时间:2016/3/10 16:46:00
--  

If e.DataCol.Name = "XMBM" Then
   Dim filter4 As String = "XMBM = \'" & e.DataRow("XMBM")  & "\' And 年度 = \'" & e.DataRow("年度") & "\'And 月份 = \'" & e.DataRow("月份") & "\'"
      e.DataRow("本月拔款") = DataTables("CZBK2").Compute("sum(BKJE)",filter4 )
      e.DataRow("本月投入资金") = DataTables("FKB2").Compute("sum(YFKJE)",filter4 )
      e.DataRow("本月国开行") = DataTables("DKFKB").Compute("sum(XFJE)",filter4 )
      
End If

就这段代码有错,删除后不提示错误,加入就会提示错误,请老师帮助,谢谢!!
--  作者:爱相随
--  发布时间:2016/3/10 16:53:00
--  
有老师在吗
--  作者:爱相随
--  发布时间:2016/3/10 17:09:00
--  
会不会是关联表中的月份是表达式的原因??
--  作者:爱相随
--  发布时间:2016/3/10 17:17:00
--  
怎么没有老师帮助我呀
--  作者:18523982317
--  发布时间:2016/3/10 17:23:00
--  
今天好像老师都不在。。放假了。。。我提的问题也没人答。。。
--  作者:爱相随
--  发布时间:2016/3/10 17:29:00
--  
Exception has been thrown by the target of an invocation调用的目标发生了异常??怎么解决呢??为什么会这样!!
[此贴子已经被作者于2016/3/10 17:29:38编辑过]

--  作者:狐狸爸爸
--  发布时间:2016/3/10 22:02:00
--  
说没有这一列,就是没有这一列,注意列的标题和列名不要搞混了,也许你你的列标题是月份,实际的列名是另一个呢。
--  作者:大红袍
--  发布时间:2016/3/11 0:22:00
--  

提示很清楚。

 

CZBK2、FKB2、DKFKB,肯定有一个表没有月份列。