Hi!
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
    myCommand.Parameters.Add(parameterUnitPrice)

>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);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.