-2
Hello,
I’m trying to do a c# query using xml but this gives me an error.
someone could help me?
code:
private void button1_Click(object sender, EventArgs e)
{
XDocument doc = XDocument.Load(@"C:\..\WindowsFormsApp10\stores.xml");
var xpath = "//store[Color='Pink']";
var result = doc.XPathEvaluate(xpath);
textBox1.Text = result.ToString();
}
error: this appears in textbox: "System.xml.Xpath.Xpathevaluator+d__1`1[System.Object]"
xml:
<stores>
<store rollNumer="170">
<Name>Jonh</Name>
<Color>Pink</Color>
<Sell>Sugar</Sell>
</store>
<store rollNumer="120">
<Name>Tedy</Name>
<Color>Brown</Color>
<Sell>Rice</Sell>
</store>
Thank you
without collecting the xml there is very difficult to help..
– Ricardo Pontual
What you want to appear in the textbox?
– tvdias
Managed to solve your problem? What you want to put in the textbox?
– tvdias