Foxtable(狐表)用户栏目专家坐堂 → [求助]若想要空置复制后,不显示为0的话,应该怎么改代码?


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

主题:[求助]若想要空置复制后,不显示为0的话,应该怎么改代码?

帅哥哟,离线,有人找我吗?
fengwenliuyan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:902 积分:8264 威望:0 精华:0 注册:2012/10/19 13:55:00
[求助]若想要空置复制后,不显示为0的话,应该怎么改代码?  发帖心情 Post By:2019/3/21 17:32:00 [只看该作者]

Dim Cols1() As String = {"入库编号","品名规格","工序","单位","入库单价","客户数量","过磅数量","应收金额","出库"}
Dim Cols2() As String = {"入库编号","品名规格","工序","单位","入库单价","客户数量","过磅数量","应收金额","出库"}
For Each dr1 As DataRow In DataTables("入库明细表").Select("[出库] = true")
    Dim dr2 As DataRow = DataTables("出库明细表").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
    dr2("客户") = e.Form.Controls("TextBox1").text
    dr1("已出库") = True
Next

"入库明细表"的数据列,若是字符列,则可以完美复制到"出库明细表"中,包括为空的单元格内容,在"出库明细表"中会不显示0;
但是,"入库明细表"的数据列,若是整数列的话,则复制到"出库明细表"中,单元格为空的内容,在"出库明细表"中显示的却是0;
若想要空置复制后,不显示为0的话,应该怎么改代码?

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


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

Dim Cols1() As String = {"入库编号","品名规格","工序","单位","入库单价","客户数量","过磅数量","应收金额","出库"}
Dim Cols2() As String = {"入库编号","品名规格","工序","单位","入库单价","客户数量","过磅数量","应收金额","出库"}
For Each dr1 As DataRow In DataTables("入库明细表").Select("[出库] = true")
    Dim dr2 As DataRow = DataTables("出库明细表").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        If dr1.IsNull(Cols1(i)) Then
            dr2(Cols2(i)) = Nothing
        Else
            dr2(Cols2(i)) = dr1(Cols1(i))
        End If
    Next
    dr2("客户") = e.Form.Controls("TextBox1").text
    dr1("已出库") = True
Next

 回到顶部