Foxtable(狐表)用户栏目专家坐堂 → 从关联父、子表中提取数据填充到另表


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

主题:从关联父、子表中提取数据填充到另表

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/28 10:24:00 [显示全部帖子]

Dim t1 As Table = Tables("高值耗材病人使用登记表")
Dim t2 As Table = Tables("高值耗材病人使用明细表")
Dim dt As DataTable = DataTables("导出骨科计划表")
dt.DataRows.Clear
Dim sCols() As String = {"手术日期","患者姓名","计划人","计划类型"}
Dim dCols() As String = {"中标号","组件名称","使用规格","厂家","单位","数量","中标价","采购价"}
For Each r As Row In t1.Rows
    For Each cr As DataRow In t2.DataTable.Select("编号 = '" & r("编号") & "'")
        Dim ndr As DataRow = dt.AddNew
        For Each c As String In scols
            ndr(c) = r(c)
        Next
        For Each c As String In dcols
            ndr(c) = cr(c)
        Next
    Next
Next
Forms("导出骨科计划主窗口").Open

 回到顶部