I have an xmlNodeList object called xmlMatchedTeams, and I want to put it into a dataset, I have tried the following and get and error anyone got any ideas below is my c# code:
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(filePath);
xmlMatchedTeams = xmldoc.SelectNodes("//MatchList/Match/Teams/Team");
foreach (XmlNode teams in xmlMatchedTeams)
{
xmldoc.LoadXml(teams.OuterXml);
if (TeamHsh.Count != 2)
{
TeamHsh.Add(teams.Attributes["teamId"].Value, teams.SelectSingleNode("LongName").InnerText);
}
}
return TeamHsh;
}
public DataSet test()
{
ds = new DataSet();
ds.ReadXml(xmlMatchedTeams);
return ds;
}
luke_bryant
Member
396 Points
361 Posts
Put xml node list to dataset
May 04, 2012 03:37 PM|LINK
Hi programmers,
I have an xmlNodeList object called xmlMatchedTeams, and I want to put it into a dataset, I have tried the following and get and error anyone got any ideas below is my c# code:
XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(filePath); xmlMatchedTeams = xmldoc.SelectNodes("//MatchList/Match/Teams/Team"); foreach (XmlNode teams in xmlMatchedTeams) { xmldoc.LoadXml(teams.OuterXml); if (TeamHsh.Count != 2) { TeamHsh.Add(teams.Attributes["teamId"].Value, teams.SelectSingleNode("LongName").InnerText); } } return TeamHsh; } public DataSet test() { ds = new DataSet(); ds.ReadXml(xmlMatchedTeams); return ds; }Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: Put xml node list to dataset
May 08, 2012 08:41 AM|LINK
Hi,
Refer this sample:
http://aspdotnetcodebook.blogspot.com/2008/04/how-to-convert-xmlnodelist-to-datatable.html
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework