以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 自动添加 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=41276) |
-- 作者:seal51 -- 发布时间:2013/10/15 15:07:00 -- 自动添加 在表A中第一列增加一行并添加数据,如何在表B中第一列也自动增加一行并添加相同的数据呢 |
-- 作者:Bin -- 发布时间:2013/10/15 15:18:00 -- 表A DataColChanged事件 if e.datacol.name="第一列" andalso e. datarow.isnull("第一列")=false then dim dr as datarow = datatables("表B").addnew dr("第一列")=e.datarow("第一列") end if
|
-- 作者:seal51 -- 发布时间:2013/10/15 22:01:00 -- 谢谢版主, 我测试了一下,可以达到我的要求, 但我发现,同一行只要改变了数据,又会在表B中新添加一行,如何做到表A的行和表B的行一一对应呢 |
-- 作者:有点甜 -- 发布时间:2013/10/15 22:10:00 -- 表B加一列,用于存储表A的系统列_Identify。参考代码 If e.DataCol.name="第一列" AndAlso e. DataRow.isnull("第一列")=False Then Dim dr As DataRow = DataTables("表B").Find("增加的列 = " & e.DataRow("_Identify")) If dr Is Nothing Then dr = DataTables("表B").addnew dr("增加的列") = e.datarow("_Identify") End If dr("第一列")=e.DataRow("第一列") End If [此贴子已经被作者于2013-10-15 22:10:15编辑过]
|
-- 作者:seal51 -- 发布时间:2013/10/15 22:25:00 -- 谢谢九尾狐, 回的好快啊 |
-- 作者:seal51 -- 发布时间:2013/10/15 22:30:00 -- 表B加一列,用于存储表A的系统列_Identify ??? 如何做呢 |
-- 作者:有点甜 -- 发布时间:2013/10/15 22:36:00 -- _Identify是不变的,你在往表B添加一行的时候,存储表A那一行的_Identify,这样就知道表B里某一行对应表A的哪一行了。 |
-- 作者:seal51 -- 发布时间:2013/10/15 22:43:00 -- 运行错误Exception has been thrown by the target of an invocation.,怎么回事 |
-- 作者:有点甜 -- 发布时间:2013/10/15 22:46:00 -- 增加的列,要是数值列。贴出你的代码。 |
-- 作者:seal51 -- 发布时间:2013/10/15 23:25:00 -- 我就是把你给的代码复制黏贴进去了 |