Foxtable(狐表)用户栏目专家坐堂 → 逻辑列自动复制行问题,请教老师们


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

主题:逻辑列自动复制行问题,请教老师们

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/11/19 9:08:00 [显示全部帖子]

一样:

 

 

If e.DataCol.Name = "逻辑列名" AndAlso e.DataRow("逻辑列名") = True Then
    Dim nma() As String = {"A1","A2","A3","A4"} 'A表数据来源列
    Dim nmb() As String = {"B1","B2","B3","B4"} 'B表和C表数据接收列
    Dim dr1 As DataRow = DataTables("表B").AddNew
    Dim dr2 As DataRow = DataTables("表C").AddNew
    For i As Integer = 0 To nma.Length - 1
        dr1(nmb(i)) = e.DataRow(nma(i))
        dr2(nmb(i)) = e.DataRow(nma(i))
    Next
End If


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/11/19 20:43:00 [显示全部帖子]

如果长度不一致,要分开写才行:

 

 

If e.DataCol.Name = "逻辑列名" AndAlso e.DataRow("逻辑列名") = True Then
    Dim nma() As String = {"A1","A2","A3","A4"} 'A表数据来源列
    Dim nmb() As String = {"B1","B2","B3","B4"} 'B表数据接收列
    Dim nmc() As String = {"B1","B2"} 'C表数据接收列
    Dim dr As DataRow = DataTables("表B").AddNew
    Dim cr As DataRow = DataTables("表C").AddNew
    For i As Integer = 0 To nmb.Length - 1
        dr(nmb(i)) = e.DataRow(nma(i))
    Next
    For i As Integer = 0 To nmc.Length - 1
        cr(nmc(i)) = e.DataRow(nma(i))
    Next
End If


 回到顶部