以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]数值相除问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88912)

--  作者:hyr88
--  发布时间:2016/8/11 15:19:00
--  [求助]数值相除问题
If e.DataCol.Name = "预估每天平均" Then
If e.DataRow.IsNull("预估支出") Then
e.DataRow("预估每天平均") = Nothing
Else
e.DataRow("预估每天平均") = e.DataRow("预估支出") \\ e.DataRow("剩余天数")
End If
End If

为什么出不来结果呢?
e.DataRow("预估支出") / e.DataRow("剩余天数")
e.DataRow("预估支出") Mod e.DataRow("剩余天数")
这几个运算方式都试过
求解,谢谢!

--  作者:大红袍
--  发布时间:2016/8/11 15:22:00
--  

If e.DataCol.Name = "预估支出" OrElse e.DataCol.Name = "剩余天数" Then
    If e.DataRow.IsNull("预估支出") OrElse e.DataRow.IsNull("剩余天数") Then
        e.DataRow("预估每天平均") = Nothing
    Else
        e.DataRow("预估每天平均") = e.DataRow("预估支出") / e.DataRow("剩余天数")
    End If
End If


--  作者:hyr88
--  发布时间:2016/9/14 18:08:00
--  
这个计算出来结果是有小数点,有什么方法把结果变整数啊?
我试过把列改为整数模式。不行,会出错。
谢谢!

--  作者:狐狸爸爸
--  发布时间:2016/9/14 18:15:00
--  

If e.DataCol.Name = "预估支出" OrElse e.DataCol.Name = "剩余天数" Then
    If e.DataRow.IsNull("预估支出") OrElse e.DataRow.IsNull("剩余天数") Then
        e.DataRow("预估每天平均") = Nothing
    Else
        e.DataRow("预估每天平均") = cint(e.DataRow("预估支出") / e.DataRow("剩余天数"))
    End If
End If