如何在GridView中显示sql查询嵌套xml?

时间:2018-02-06 19:28:00

标签: c# asp.net sql-server xml gridview

所以,我在asp.net中有xml配置文件,带有嵌套的sql查询,用于在GridView中显示数据。我从未见过这种格式的xml代码,有什么想法吗?

<grid>
<primary_key>DeclarationGUID</primary_key>
<query>
    SELECT DeclarationGUID,
        SequenceNum,
        AcceptanceDate,
    FROM Declaration
</query>
<grid>
    <foreign_key>DeclarationGUID</foreign_key>
    <primary_key>GoodsItemGUID</primary_key>
    <query>
        SELECT DeclarationGUID,
            GoodsItemGUID,
            SequenceNum,
            CommodityCode,
        FROM GoodsItem 
        WHERE DeclarationGUID=@@DeclarationGUID@@
    </query>
    <grid>
        <foreign_key>DeclarationGUID</foreign_key>
        <foreign_key>GoodsItemGUID</foreign_key>
        <primary_key>ContainerGUID</primary_key>
        <query>
            SELECT DeclarationGUID,
                GoodsItemGUID,
                ContainerGUID,
                Identifier
            FROM GoodsItemContainer
            WHERE GoodsItemGUID=@@GoodsItemGUID@@
        </query>
    </grid>
</grid>

0 个答案:

没有答案