Foxtable(狐表)用户栏目专家坐堂 → 自动复制


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

主题:自动复制

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/11/27 19:04:00 [显示全部帖子]

 呃,楼主,你把 then 去掉就行了

If e.DataCol.Name = "数量" Then
    If e.DataRow.Isnull("数量") = False
    Dim n As Integer = e.DataRow("数量")
    Dim nma() As String = {"入库单号","名称","规格"}
    Dim nmb() As String = {"入库单号","名称","规格"}
    dim drlist as List(of datarow) = DataTables("固定资产库存").select("入库单号='" & e.datarow("入库单号") & "'")
    if drlist is nothing then
    for i as integer = 1 to n
    Dim dr As DataRow = DataTables("固定资产库存").AddNew()
    For i As Integer = 0 To nma.Length - 1
        dr(nmb(i)) = e.DataRow(nma(i))
    Next
    next
    else
    if drlist.count>n then
       for i as integer=0 to drlist.count-n-1
           drlist(i).Delete
       next
    end if
    end if
  End If
End If

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/11/27 19:25:00 [显示全部帖子]

 试试这样

If e.DataCol.Name = "数量" Then
    If e.DataRow.Isnull("数量") = False
        Dim n As Integer = e.DataRow("数量")
        Dim nma() As String = {"入库单号","名称","规格"}
        Dim nmb() As String = {"入库单号","名称","规格"}
        dim drlist as List(of datarow) = DataTables("固定资产库存").Select("入库单号='" & e.DataRow("入库单号") & "'")
        If drlist Is Nothing Then
            For i As Integer = 1 To n
                Dim dr As DataRow = DataTables("固定资产库存").AddNew()
                For j As Integer = 0 To nma.Length - 1
                    dr(nmb(j)) = e.DataRow(nma(j))
                Next
            Next
        Else
            If drlist.count>n Then
                For i As Integer=0 To drlist.count-n-1
                    drlist(i).Delete
                Next
            End If
        End If
    End If
End If

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/11/27 20:08:00 [显示全部帖子]

 代码如下

If e.DataCol.Name = "数量" Then
    If e.DataRow.Isnull("数量") = False
        Dim n As Integer = e.DataRow("数量")
        Dim nma() As String = {"入库单号","名称","规格"}
        Dim nmb() As String = {"入库单号","名称","规格"}
        dim drlist as List(of datarow) = DataTables("固定资产库存").Select("入库单号='" & e.DataRow("入库单号") & "'")
        If drlist.count <= n Then
            For i As Integer = 1 To n - drlist.count
                Dim dr As DataRow = DataTables("固定资产库存").AddNew()
                For j As Integer = 0 To nma.Length - 1
                    dr(nmb(j)) = e.DataRow(nma(j))
                Next
            Next
        Else
            For i As Integer=0 To drlist.count-n-1
                drlist(i).Delete
            Next
        End If
    End If
End If
[此贴子已经被作者于2013-11-27 20:11:43编辑过]

 回到顶部