以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 将外部数据表记录逐行写入另一数据表 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=115172) |
-- 作者:yetle -- 发布时间:2018/3/2 10:40:00 -- 将外部数据表记录逐行写入另一数据表 需求:将外部数据表MS_Client的记录逐行都写入“客户资料”表,弹出来“索引超出了数组界限”提示,且“客户资料”表只新增第一行第一列的数据 Dim Result As DialogResult Result = MessageBox.Show("对接资料会覆盖原有数据,确定要对接客户资料吗?","提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then If Tables("MS_Client").Rows IsNot Nothing Then Tables("客户资料").stopredraw Dim nma() As String = {"client_no","name","sala_addre","rea_man","rea_tel"} \'A表数据来源列 Dim nmb() As String = {"客户编号","公司名称","地址","联系人","联系方式"} \'B表数据接收列 For n As Integer = 1 To Tables("MS_Client").Rows.count - 1 Dim r As Row = Tables("客户资料").addnew() r(nmb(n)) = Tables("MS_Client").current(nma(n)) Next Tables("客户资料").ResumeRedraw() End If End If [此贴子已经被作者于2018/3/2 10:40:24编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/3/2 11:01:00 -- Dim Result = MessageBox.Show("对接资料会覆盖原有数据,确定要对接客户资料吗?","提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Tables("客户资料").stopredraw Dim nma() As String = {"client_no","name","sala_addre","rea_man","rea_tel"} \'A表数据来源列 Dim nmb() As String = {"客户编号","公司名称","地址","联系人","联系方式"} \'B表数据接收列 For Each dr As Row In Tables("MS_Client").Rows Dim r As Row = Tables("客户资料").addnew() For n As Integer = 0 To nmb.length -1 r(nmb(n)) = dr(nma(n)) Next Next Tables("客户资料").ResumeRedraw() End If |
-- 作者:有点甜 -- 发布时间:2018/3/2 11:02:00 -- 参考
http://www.foxtable.com/webhelp/scr/1533.htm
|
-- 作者:yetle -- 发布时间:2018/3/2 11:33:00 -- 好了,非常感谢 好了,非常感谢 |