Foxtable(狐表)用户栏目专家坐堂 → 新增项目表记录时,整体复制表中内容到项目表子表工料单价表中


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

主题:新增项目表记录时,整体复制表中内容到项目表子表工料单价表中

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


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

DataRowAdded事件,写代码,查考着改。

 

e.DataRow.save
Dim Cols1() As String = {"工料一类","工料单位","工料单价"}
Dim Cols2() As String = {"工料一类","工料单位","工料单价"}
For Each dr1 As DataRow In DataTables("单价列表").Select("")
    Dim dr2 As DataRow = DataTables("工料单价").find("工料名称= '" & dr1("工料名称") & "' and _Identify = " & e.DataRow("_Identify"))
    If dr2 Is Nothing Then dr2 = DataTables("工料单价").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next


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


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

e.DataRow.save
systemready = false
Dim Cols1() As String ={"单价列表id","工料一类","工料二类","工料名称","工料单位","工料单价","备注"}
Dim Cols2() As String ={"单价列表id","工料一类","工料二类","工料名称","工料单位","工料单价","备注"}
For Each dr1 As DataRow In DataTables("单价列表").Select("")
    Dim dr2 As DataRow = DataTables("工料单价").find("工料名称 = '" & dr1("工料名称") & "' and 单价列表id = '" & dr1("单价列表id") & "' and _Identify = " & e.DataRow("_Identify"))
    If dr2 Is Nothing Then dr2 = DataTables("工料单价").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next
systemready = true

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


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

e.DataRow.save
systemready = False
Dim Cols1() As String ={"单价列表id","工料一类","工料二类","工料名称","工料单位","工料单价","备注"}
Dim Cols2() As String ={"单价列表id","工料一类","工料二类","工料名称","工料单位","工料单价","备注"}
For Each dr1 As DataRow In DataTables("单价列表").Select("")
    Dim dr2 As DataRow = DataTables("工料单价").find("工料名称 = '" & dr1("工料名称") & "' and 单价列表id = '" & dr1("单价列表id") & "' and _Identify = " & e.DataRow("_Identify"))
    If dr2 Is Nothing Then dr2 = DataTables("工料单价").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
    dr2("项目id") = e.DataRow("_Identify")
Next
systemready = True

 回到顶部