I have been looking into this the whole day, and I haven't found any good straight answers to my problem. So what i am trying to do, is that I have a XML file where i have defined for example what is the name of the column (In this example, unit price), and what is the type of the column cells (currency in this case). Is there ANY way to read this data from the XML file with C#, so that I could replace "@UnitPrice", OleDbType.Currency and parameterUnitPrice from the code below, with the info from the XML file? Or am I trying to reach heavens here and realize that it's not possible? How should i modify my code in order to do what im trying to do, and how to read the data from XML file?

Dim parameterUnitPrice as OleDbParameter = _
               new OleDbParameter("@UnitPrice", OleDbType.Currency)
    parameterUnitPrice.Value = dblPrice

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

6 Years
Discussion Span
Last Post by __avd

>Is there ANY way to read this data from the XML file with C#

Have look at code-snippet.

string xml = "<?xml version=\"1.0\" ?><Code><Item><Para>a1</Para><Value>10</Value></Item><Item><Para>a3</Para><Value>30</Value></Item></Code>";

XDocument x = XDocument.Parse(xml);

foreach (XElement ele in x.Descendants("Item"))
  Console.WriteLine(ele.Element("Para").Value + " " + ele.Element("Value").Value);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.