以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  克隆行时,对于全球唯一码,仍然复制,该怎么办?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88575)

--  作者:大红袍
--  发布时间:2016/8/5 10:36:00
--  

不要直接复制行,用代码处理

 

Dim cname As String = "第一列"
Dim r As Row = Tables("表A").current
Dim nr As Row = r.Table.AddNew
For Each c As Col In r.Table.cols
    If c.name <> cname Then
        nr(c.name) = r(c.name)
    End If
Next


--  作者:Hyphen
--  发布时间:2016/8/24 11:59:00
--  
Dim cname As String = DataTables("表A").basetable.PrimaryKey(0).ColumnName 
Dim r As Row = Tables("表A").current
Dim nr As Row = r.Table.AddNew
For Each c As Col In r.Table.cols
    If c.name <> cname Then
        nr(c.name) = r(c.name)
    End If
Next

--  作者:blackzhu
--  发布时间:2016/8/24 13:01:00
--  
 r.Table 还能这样写? 第一次才看到,学了一招

--  作者:大红袍
--  发布时间:2016/8/25 14:28:00
--  

处理一下空值即可

 

    If c.name <> cname Then
        nr(c.name) = iif(r.IsNull(c.name), Nothing, r(c.name))
    End If