HOME

Share

Search in XML file using C#, ASP.Net /loop through XML C#

Are you working with ASP.Net? Then...your companion is here....
Ask anything...you will get a solution...

Search in XML file using C#, ASP.Net /loop through XML C#

Postby David on 14 Jul 2008 05:18

Traverse through xml nodes in C# asp.net, search xml nodes by passing node values
Search in XML file using C# ASP.Net/ loop through XML nodes using C#

This example use to find out the name and pin of a particular employee ...by passing empcode as parameter
String Name;
int pin;
public void fillfromXML(string Code)
{
doc.Load(Server.MapPath(@"Address.xml"));
XmlNodeList addlst = doc.SelectNodes("Address/add/Empcode");
foreach (XmlNode Empcode in addlst)
{
if (Empcode.InnerText == Code)
{
string Name = Empcode.ParentNode.ChildNodes[2].InnerText;
int pin = Convert.ToInt32(Empcode.ParentNode.ChildNodes[3].InnerText);
}
}

Any query feel free to ask.......
:idea:
}
David
 
Posts: 133
Joined: 14 Jul 2008 01:37

Return to ASP.Net

Who is online

Users browsing this forum: No registered users and 24 guests