Note that there are some explanatory texts on larger screens.

plurals
  1. POXml to Datagrid, Show lines from selected invoice
    primarykey
    data
    text
    <pre><code>&lt;Documents&gt; &lt;Sales&gt; &lt;Total&gt;81678.600000&lt;/Total&gt; &lt;Invoice&gt; &lt;InvoiceNum&gt;153&lt;/InvoiceNum&gt; &lt;Date&gt;2013-03-01&lt;/Date&gt; &lt;Customer&gt;2589&lt;/Customer&gt; &lt;Line&gt; &lt;ProductId&gt;AT.02-2584&lt;/ProductId&gt; &lt;Description&gt;Product 1&lt;/Description&gt; &lt;Quantity&gt;1.000&lt;/Quantity&gt; &lt;UnitPrice&gt;265.140000&lt;/UnitPrice&gt; &lt;/Line&gt; &lt;/Invoice&gt; &lt;Invoice&gt; &lt;InvoiceNum&gt;154&lt;/InvoiceNum&gt; &lt;Date&gt;2013-03-01&lt;/Date&gt; &lt;Customer&gt;2589&lt;/Customer&gt; &lt;Line&gt; &lt;ProductId&gt;AT.02-2584&lt;/ProductId&gt; &lt;Description&gt;Product 1&lt;/Description&gt; &lt;Quantity&gt;1.000&lt;/Quantity&gt; &lt;UnitPrice&gt;265.140000&lt;/UnitPrice&gt; &lt;/Line&gt; &lt;Line&gt; &lt;ProductId&gt;AT.02-2599&lt;/ProductId&gt; &lt;Description&gt;Product 2&lt;/Description&gt; &lt;Quantity&gt;1.000&lt;/Quantity&gt; &lt;UnitPrice&gt;85.100000&lt;/UnitPrice&gt; &lt;/Line&gt; &lt;/Invoice&gt; &lt;/Sales&gt; </code></pre> <p></p> <p>I have this xml document, and i need show the lines (<code>&lt;Line&gt;</code> tag) when select an invoice in a datagridview. I have the following code, but only know how to show subelements of main element <code>"&lt;Invoice&gt;"</code>. How can query to show only <code>"&lt;Line&gt;"</code> elements for each <code>"&lt;InvoiceNum&gt;"</code> in datagrid:</p> <pre><code>filepath1 = "C:\Users\Documents\Teste.xml" Dim xml As XDocument = XDocument.Load(filepath1) Dim query = From xe In xml.Descendants("Invoice") Where xe.Element("InvoiceNum").Value = "153" Select New With { .Invoice = xe.Element("InvoiceNum").Value, .Date = xe.Element("Date").Value } DataGridView1.DataSource = query.ToArray </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload