我有大約100.000個xml文件,每個文件包含1行數據(但它有2個父項)。如何將XML導入帶有父母的C#的SQL Server數據庫
讀取這些XML文件並將數據寫入SQL Server表的最佳方式是什麼?
這是我的XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<recording>
<dataformat>audio</dataformat>
<starttime>2015-02-09 08:57:08:000 +0200</starttime>
<endtime>2015-02-09 08:58:48:000 +0200</endtime>
<nostart>false</nostart>
<noend>false</noend>
<recordingtype>stnbulk</recordingtype>
<recordingline></recordingline>
<servicename>005379763634</servicename>
<servicenumber></servicenumber>
<deliberatebreak>0</deliberatebreak>
<calldirection>Outgoing</calldirection>
<filename>890001000000003.wav</filename>
<otherinum>0</otherinum>
<callparty>1</callparty>
<recordingowners>
<recordingowner>131</recordingowner>
</recordingowners>
<parties>
<party id="1">
<number>131</number>
<name>Santral131</name>
<pstarttime>2015-02-09 08:58:48:912 +0200</pstarttime>
<pendtime>2015-02-09 08:58:48:912 +0200</pendtime>
</party>
<party id="2">
<number>005379763634</number>
<pstarttime>2015-02-09 08:58:48:912 +0200</pstarttime>
<pendtime>2015-02-09 08:58:48:912 +0200</pendtime>
</party>
</parties>
<guids>
</guids>
</recording>
我試圖通過使用XmlReader
的數據集插入到SQL Server數據庫中讀取這些數據,但沒有奏效。
在此先感謝您的支持。
也許嘗試使用'System.Xml.Linq'命名空間中的'XElement'類? – krypru