您是否考虑过使用 LINQ to XML?
一个样本可以是:
XElement xTableA = new XElement
(
"TableA",
TableA
.Where(x=>x.FirstName == firstname && x.LastName == lastname)
.Select
(
x=>
new XElement
(
"Row",
new XElement("FirstName",x.FirstName),
new XElement("MiddleName",x.MiddleName),
new XElement("LastName",x.LastName)
)
);
XElement xTableB = new XElement
(
"TableB",
TableB
.Where(x=>x.FirstName == firstname && x.LastName == lastname)
.Select
(
x=>
new XElement
(
"Row",
new XElement("FirstName",x.FirstName),
new XElement("MiddleName",x.MiddleName),
new XElement("LastName",x.LastName)
)
);
XElement xTableC = new XElement
(
"TableC",
TableC
.Where(x=>x.FirstName == firstname && x.LastName == lastname)
.Select
(
x=>
new XElement
(
"Row",
new XElement("FirstName",x.FirstName),
new XElement("MiddleName",x.MiddleName),
new XElement("LastName",x.LastName)
)
);
xTableA.Save(filenameA);
xTableB.Save(filenameB);
xTableC.Save(filenameC);
这样,您就有了三个 xml 文件,其中包含您请求的数据准备好导入...