Xml到Datagrid,显示所选发票中的行

时间:2013-05-22 16:05:17

标签: c# vb.net

<Documents>
   <Sales>
    <Total>81678.600000</Total>
    <Invoice>
        <InvoiceNum>153</InvoiceNum>
        <Date>2013-03-01</Date>
        <Customer>2589</Customer>
        <Line>
            <ProductId>AT.02-2584</ProductId>
            <Description>Product 1</Description>
            <Quantity>1.000</Quantity>
            <UnitPrice>265.140000</UnitPrice>
        </Line>
    </Invoice>      
    <Invoice>
        <InvoiceNum>154</InvoiceNum>
        <Date>2013-03-01</Date>
        <Customer>2589</Customer>
        <Line>
            <ProductId>AT.02-2584</ProductId>
            <Description>Product 1</Description>
            <Quantity>1.000</Quantity>
            <UnitPrice>265.140000</UnitPrice>
        </Line>
                    <Line>
            <ProductId>AT.02-2599</ProductId>
            <Description>Product 2</Description>
            <Quantity>1.000</Quantity>
            <UnitPrice>85.100000</UnitPrice>
        </Line>
    </Invoice>  
</Sales>

我有这个xml文档,我需要在datagridview中选择发票时显示行(<Line>标记)。我有以下代码,但只知道如何显示主元素"<Invoice>"的子元素。如何查询以仅显示datagrid中每个"<Line>"的{​​{1}}元素:

"<InvoiceNum>"

0 个答案:

没有答案