以文本方式查看主题

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

--  作者:shiliang_010
--  发布时间:2011/9/21 15:03:00
--  为什么不计算

为什么不计算?

If e.DataCol.IsNumeric Then
    If e.NewValue = 0 Then
        e.NewValue = Nothing
    End If
End If


Dim ds As DataTable=DataTables("电量统计表")
Dim dr As DataRow
        \'否则在产品表查找同名的产品行,将找到的行赋值给变量dr
        dr = DataTables("电量统计表").Find("[成本费用项目] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
            e.DataRow("电力_电量") = dr("用电量")
           e.DataRow("电力_金额") = dr("用电金额")
        End If





--  作者:狐狸爸爸
--  发布时间:2011/9/21 15:04:00
--  

请将你表传上来,告诉大家在哪个表的哪个事件设置了什么代码,目的是什么,出现了什么问题。


--  作者:blackzhu
--  发布时间:2011/9/21 15:07:00
--  

为什么不计算?

Dim dr As DataRow

If e.DataCol.Name ="列名" Then
    If e.Datarow.isNull("列名")Then
        e.Datarow("列名" = Nothing

Else
dr = DataTables("电量统计表").Find("[成本费用项目] = \'" & e.NewValue & "\'")

 

        If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
            e.DataRow("电力_电量") = dr("用电量") 
           e.DataRow("电力_金额") = dr("用电金额")
        End If

end if

end if


--  作者:shiliang_010
--  发布时间:2011/9/21 15:17:00
--  

谢谢