如何将xml直接读入到recordset
用循环,将xml读入生成recordset,在性能上有所缺陷。
先考虑将xml直接读入recordset:
<portfolio>
<stock>
<symbol>MSFT</symbol>
<price>$66.00</price>
<companyname>Microsoft Corporation</companyname>
<website>http://www.microsoft.com</website>
</stock>
<stock>
<symbol>AAPL</symbol>
<price>$110.00</price>
<companyname>Apple Computer, Inc.</companyname>
<website>http://www.apple.com</website>
</stock>
<stock>
<symbol>DELL</symbol>
<price>$50.00</price>
<companyname>Dell Corporation</companyname>
<website>http://www.dell.com</website>
</stock>
<stock>
<symbol>INTC</symbol>
<price>$136.00</price>
<companyname>Intel Corporation</companyname>
<website>http://www.intel.com</website>
</stock>
</portfolio>
Dim rstxml As New ADODB.Recordset
rstxml.ActiveConnection = "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
rstxml.Open "xml路径"
Sheet1.Range("A1").CopyFromRecordset rstxml