0
我有一個數據集,它從XML文件中填充,我想將主數據表分成幾個數據表。asp.net splitting xml數據表
比方說,這是表的格式:
Column1 | Column2
1234 | 4567
1234 | 1122
1234 | 2233
1000 | 3344
1000 | 5566
我需要上述拆分成2個表,一個包含了所有的1234個值,一個是1000倍的值。
這是我如何讀取xml文件和正常工作:
WebClient wc = new WebClient();
wc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
string strXmlString = wc.DownloadString(strUrl); // Download the URL to a string
strXmlString = Regex.Replace(strXmlString, @"m:null.+?>{1}", @"/>"); // Find ' m:null[anything]>' and replace it with '/>'
strXmlString = Regex.Replace(strXmlString, @"[\s]{1}m:.+?>{1}", @">"); // Find ' m:type[anything]>' and replace it with '>'
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(strXmlString); // Load the XML String into an XML Doc
XmlReader xReader = new XmlNodeReader(xDoc);
DataSet ds = new DataSet();
ds.ReadXml(xReader); // Upload the XML Doc Data to the DataSet
我怎麼會分裂成ds.Tables[0]
2個表?
這兩種解決方案的工作。謝謝。 –