以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  筛选后的数据填充到B表  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=99690)

--  作者:蓝蚂蚁
--  发布时间:2017/4/25 9:28:00
--  筛选后的数据填充到B表
窗口中的表绑定到A表(即作为副本),在窗口中对副本表进行筛选,然后把筛选后的数据填充到B表,代码如何实现?
下面的代码会把所有A表的数据进行填充,如何只填充筛选后的数据。谢谢!
If Tables("高值耗材总使用明细表").Rows.Count>0 Then
    If MessageBox.Show("是否写入高值耗材采购总计划表","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)=DialogResult.Yes Then
        Dim Cols1() As String = {"手术日期","住院号","患者姓名","中标号","组件名称","使用规格","厂家","单位","中标价","采购价","数量","金额","配送公司"}
        Dim Cols2() As String = {"手术日期","住院号","患者姓名","中标号","组件名称","所用规格","生产企业","单位","中标价","采购价","数量","金额","配送公司"}
        For Each dr1 As DataRow In DataTables("高值耗材总使用明细表").Select("","手术日期 DESC,患者姓名 DESC" )
            Dim dr2 As DataRow = DataTables("新版高值耗材采购计划总表").AddNew()
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
        Next
    End If
End If

--  作者:有点色
--  发布时间:2017/4/25 9:31:00
--  
Dim t As Table = Tables("窗口1_Table1")
If t.Rows.Count>0 Then
    If MessageBox.Show("是否写入高值耗材采购总计划表","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)=DialogResult.Yes Then
        Dim Cols1() As String = {"手术日期","住院号","患者姓名","中标号","组件名称","使用规格","厂家","单位","中标价","采购价","数量","金额","配送公司"}
        Dim Cols2() As String = {"手术日期","住院号","患者姓名","中标号","组件名称","所用规格","生产企业","单位","中标价","采购价","数量","金额","配送公司"}
        For Each dr1 As DataRow In DataTables("高值耗材总使用明细表").Select(t.filter,"手术日期 DESC,患者姓名 DESC" )
            Dim dr2 As DataRow = DataTables("新版高值耗材采购计划总表").AddNew()
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
        Next
    End If
End If

--  作者:蓝蚂蚁
--  发布时间:2017/4/25 10:38:00
--  
高手,膜拜中...........