Foxtable(狐表)用户栏目专家坐堂 → 在 datarowadded 事件下的问题


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

主题:在 datarowadded 事件下的问题

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/20 0:46:00 [显示全部帖子]

代码这样写

 

If e.DataRow.IsNull("编号") Then
   
Else
    Dim ar As DataRow = e.DataRow '新增行的行号
    Dim fr As Integer = ar("编号") '新增行的编号
    Dim dr As DataRow
       
    dr= DataTables("使用情况").find("编号='" & fr & "'") '新增物品编号的行
    If dr IsNot Nothing Then
        ar("物品品名") =dr("物品品名")
        e.DataTable.Save()
    End If   
End If


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/20 0:47:00 [显示全部帖子]

你应该写到DataColChanged事件才对的

 

If e.DataCol.name = "编号" Then
    If e.DataRow.IsNull("编号") Then
       
    Else
        Dim ar As DataRow = e.DataRow '新增行的行号
        Dim fr As Integer = ar("编号") '新增行的编号
        Dim dr As DataRow
       
        dr= DataTables("使用情况").find("编号='" & fr & "'") '新增物品编号的行
        If dr IsNot Nothing Then
            ar("物品品名") =dr("物品品名")
            e.DataTable.Save()
        End If
    End If
End If


 回到顶部