假定表A是父表,表B是子表,代码大概如下,请自行理解调试:
Dim Childs As List(of DataRow) = Tables("表A").Current.DataRow.GetChildRows("表B")
Dim pr As Row = Tables("表A").AddNew
pr("关联列") = "aaa" '如果通过_Identify列关联,则不需要此行
For Each cr As DataRow In Childs
Dim nr As Row = Tables("表A.表B").AddNew
For Each cl As Col In Tables("表B").Cols
If cl.Name <> "关联列" Then
nr(cl.name) = cr(cl.Name)
End If
Next
Next