如题
<News>
<NewsCols>
<Title></Title>
<Content></Content>
</NewsCols>
</News>
上面表现为字符串,怎样加载到DataSet中
---------------------------------------------------------------
DataSet.ReadXml()
base on .Net 2.0
---------------------------------------------------------------
Something like
string s = ".........";
System.IO.StringReader reader = new System.IO.StringReader (s);
DataSet ds = new DataSet();
ds.ReadXml(reader);
---------------------------------------------
string str=@"<News>
<NewsCols>
<Title></Title>
<Content></Content>
</NewsCols>
</News>";
//Transfer xml string to DataSet
string NewLine = System.Environment.NewLine;
string s = str.Replace(NewLine,"");
System.IO.StringReader reader = new System.IO.StringReader(s);
DataSet ds=new DataSet();
ds.ReadXml(reader as System.IO.TextReader);
reader.Close();