Foxtable(狐表)用户栏目专家坐堂 → [求助]Excel导入


  共有6616人关注过本帖树形打印复制链接

主题:[求助]Excel导入

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110551 积分:562645 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/10/26 15:26:00 [显示全部帖子]

可以的

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110551 积分:562645 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/10/26 16:00:00 [显示全部帖子]

多看看基础:http://www.foxtable.com/webhelp/topics/1592.htm,很多基本的语法都没搞懂

Dim Cols1() As String = {"科室", "领料人", "工号", "申领日期"}
For Each dr1 As DataRow In DataTables("表A").datarowas
    Dim dr2 As DataRow = DataTables("表B").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
dr2("品名") = dr1("品名1")
dr2("品名数量") = dr1("品名1数量")
if dr1.isnull("品名2") = false then
    dr2 = DataTables("表B").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
dr2("品名") = dr1("品名2")
dr2("品名数量") = dr1("品名2数量")
endif
Next

 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110551 积分:562645 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/10/26 16:36:00 [显示全部帖子]

放到循环里咯
Dim s1() As String = {"品名1", "....", "品名6"}
Dim s2() As String = {"数量1", "....", "数量6"}
for k as integer  = 0 to s1.length -1
if dr1.isnull(s1(k)) = false then
    dr2 = DataTables("表B").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
dr2("品名") = dr1(s1(k))
dr2("品名数量") = dr1(s2(k))
endif

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110551 积分:562645 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/10/27 11:35:00 [显示全部帖子]

Dim Cols1() As String = {"科室", "领料人", "工号", "申领日期"}
Dim s1() As String = {"品名1", "品名2", "品名3", "品名4", "品名5", "品名6"}
Dim s2() As String = {"品名1数量", "品名2数量", "品名3数量", "品名4数量", "品名5数量", "品名6数量"}
For Each dr1 As DataRow In DataTables("表A").datarowas
for k as integer  = 0 to s1.length -1
if dr1.isnull(s1(k)) = false then
    dr2 = DataTables("表B").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols1(i)) = dr1(Cols1(i))
    Next
dr2("品名") = dr1(s1(k))
dr2("品名数量") = dr1(s2(k))
endif
Next

 回到顶部