先给你一个思路,随便写的,自己琢磨一下:
1、动态创建数据源,连接到要合并的文件
http://help.foxtable.com/topics/1494.htm
2、用SQlCommand的ExcuteReader从要合并的文件生成三个DataTable,分别为dt1和dt2和dt3
http://help.foxtable.com/topics/0696.htm
3、
For each dr1 as datarow in dt1.DataRows
Dim dr2 as datarow = DataTables("表A").AddNew()
for each dc as datarow in dt1.DataCols
if dc.name <> "主键名称"
dr2(dc.name) = dr1(dc.name)
end if
next
dim drs2 as list(of datartow) = dt2.Select("主键名= " & dr1(主键名))
for each dr3 as datarow in drs2
Dim dr4 As DataRow = DAtaTables("表B").AddNew
dr4("主键名称") = dr2(主键名称)
for each dc as datarow in dt2.dataCols
if dc.name <> "主键名称" then
dr4(dc.name) = dr3(dc.name)
end if
next
next