以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  为什么_Identify的值复制不了?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=119866)

--  作者:happyft
--  发布时间:2018/6/2 19:12:00
--  为什么_Identify的值复制不了?
\'---将点击行的值复制到右边
Dim tbl As Table = e.Table
Dim tbl2 As Table = Tables(e.Table.Form.name & "_tbfill")
If tbl.cols.contains("第一列") = False Then
    Dim r As Row = e.Row
    Dim dr As DataRow = tbl2.DataTable.Find("_Identify = " & r("_Identify"))
    If dr Is Nothing Then  \'不存在才加入
        Dim r1 As Row = tbl2.AddNew()
        For Each c As Col In tbl.Cols
            r1(c.name) = r(c.name)
        Next
msgbox(r("_Identify") & "-" & r1("_Identify"))
    End If
End If

窗口中两个表都是sqltable,左侧表中查询到了数据,包含有_Identify列,双击左表行时将双击行的所有列复制到右侧表
但执行后用msgbox显示时右侧表的当前行的_identify都是0,即没有复制过去?为什么呢

谢谢!

--  作者:有点甜
--  发布时间:2018/6/3 12:19:00
--  

1、cols并不包含_Identify列;

 

2、_Identify列,如果是自动递增的,是不能直接赋值的,赋值没用。


--  作者:HappyFt
--  发布时间:2018/6/3 19:32:00
--  
两个都是查询表,只是想用_Identify来作为条件选择还没有选中的数据,现在是在查询中再多一个字段将_Identify as 行号,然后用行号来判断就可以了,
还想请教一下,如果用类似
 For Each c As dataCol In datatables("表A")dataCols
...
 Next
这样的遍历也不包括_Identify列,但msgbox(r("_Identify"))可以显示正常的值呢,是不是_Identify列的值可以引用,但想用_identify的列名在加载表中就是没有对吗?

--  作者:有点甜
--  发布时间:2018/6/3 19:36:00
--  

循环里面找不到_Identify的,在循环之外,再单独取值赋值即可。