以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]第三个表是两个表的交集(共同记录) (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=79738) |
||||
-- 作者:易服 -- 发布时间:2016/1/8 10:09:00 -- [求助]第三个表是两个表的交集(共同记录) 生态补偿表是贫困户表和公益林表的共同记录(交集),以身份证号为关联字段。
|
||||
-- 作者:大红袍 -- 发布时间:2016/1/8 10:11:00 -- 直接用查询表即可
http://www.foxtable.com/help/topics/2321.htm
|
||||
-- 作者:大红袍 -- 发布时间:2016/1/8 10:21:00 -- DataTables("生态补偿").ResumeRedraw DataTables("生态补偿").StopRedraw DataTables("生态补偿").DataRows.Clear Dim Cols1() As String = {"户主姓名", "身份证号","家庭人口"} Dim Cols2() As String = {"户主姓名", "户主证件号码","人数"} For Each dr As DataRow In DataTables("贫困户").Select("") Dim fdr As DataRow = DataTables("生态补偿").find("身份证号 = \'" & dr("户主证件号码") & "\'") If fdr Is Nothing fdr = DataTables("生态补偿").AddNew() End If For i As Integer = 0 To Cols1.Length -1 fdr(Cols1(i)) = dr(Cols2(i)) Next Next Dim Cols3() As String = {"户主姓名", "身份证号","县"} Dim Cols4() As String = {"姓名", "身份证号","县"} For Each dr As DataRow In DataTables("公益林").Select("") Dim fdr As DataRow = DataTables("生态补偿").find("身份证号 = \'" & dr("身份证号") & "\'") If fdr Is Nothing fdr = DataTables("生态补偿").AddNew() End If For i As Integer = 0 To Cols1.Length -1 fdr(Cols3(i)) = dr(Cols4(i)) Next Next DataTables("生态补偿").ResumeRedraw |