以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]更改一下订单表的客户名,明细表的客户名会重新新增一行,  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=45490)

--  作者:xianxin2010
--  发布时间:2014/1/27 12:07:00
--  [求助]更改一下订单表的客户名,明细表的客户名会重新新增一行,

 

是搜到这个帖子,http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=34628

 

模仿做的,功能都实现了,但是后续只要更改一下订单表的客户名,明细表的客户名会重新新增一行,不是在原有的单元格内更改的,

 

 

在订单表的 DataColChanged 增加了以下代码


If e.DataCol.Name = "编号" OrElse e.DataCol.Name = "客户名"  Then
    Dim dr As DataRow = DataTables("明细表").AddNew()
    If e.DataRow.IsNull("编号") = False AndAlso e.DataRow.IsNull("客户名") = False Then
        dr("编号") = e.DataRow("编号")
        dr("客户名") = e.DataRow("客户名")
    Else
        dr("编号") = Nothing
        dr("客户名") = Nothing
    End If
End If

 

 

 

 下载信息  [文件大小:   下载次数: ]
点击浏览该文件:管理项目5.table

[此贴子已经被作者于2014-1-27 12:07:41编辑过]

--  作者:sunsenfeng
--  发布时间:2014/1/27 12:18:00
--  
Dim dr As DataRow = DataTables("明细表").AddNew()
就是这一句追加的新行
如果你在更改时不想做社么,那么删除掉所有代码即可

--  作者:xianxin2010
--  发布时间:2014/1/27 12:33:00
--  
以下是引用sunsenfeng在2014-1-27 12:18:00的发言:
Dim dr As DataRow = DataTables("明细表").AddNew()
就是这一句追加的新行
如果你在更改时不想做社么,那么删除掉所有代码即可

 删除掉所有代码,那原来的功能就没有了,在订单表输入编号和客户名,自动在明细表生成编号和客户名的功能就没有了  得不偿失了


--  作者:lsy
--  发布时间:2014/1/27 12:49:00
--  
If e.DataCol.Name = "编号" OrElse e.DataCol.Name = "客户名"  Then
    If e.DataRow.RowState = DataRowState.Added Then
        Dim dr As DataRow = DataTables("明细表").AddNew()
        If e.DataRow.IsNull("编号") = False AndAlso e.DataRow.IsNull("客户名") = False Then
            dr("编号") = e.DataRow("编号")
            dr("客户名") = e.DataRow("客户名")
        Else
            dr("编号") = Nothing
            dr("客户名") = Nothing
        End If
    End If
End If

--  作者:xianxin2010
--  发布时间:2014/1/27 13:14:00
--  
以下是引用lsy在2014-1-27 12:49:00的发言:
If e.DataCol.Name = "编号" OrElse e.DataCol.Name = "客户名"  Then
    If e.DataRow.RowState = DataRowState.Added Then
        Dim dr As DataRow = DataTables("明细表").AddNew()
        If e.DataRow.IsNull("编号") = False AndAlso e.DataRow.IsNull("客户名") = False Then
            dr("编号") = e.DataRow("编号")
            dr("客户名") = e.DataRow("客户名")
        Else
            dr("编号") = Nothing
            dr("客户名") = Nothing
        End If
    End If
End If

 再次感谢