0

我不确定我做错了什么,这是错误:'column' argument cannot be null. Parameter name: column

我想附加这个 XML 文档:

<?xml version="1.0" encoding="UTF-8"?>
<products>
    <product>
        <Name><![CDATA[G5]]></Name>
        <Type><![CDATA[44214]]></Type>
    </product>
    <product>
        <Name><![CDATA[G8]]></Name>
        <Type><![CDATA[44]]></Type>
    </product>
</products>

对此:

<?xml version="1.0" encoding="UTF-8"?>
<products>
    <product>
        <Name><![CDATA[G5]]></Name>
        <Brand><![CDATA[Sim]]></Brand>
        <Price><![CDATA[14]]></Price>
        <Price><![CDATA[8]]></Price>
    </product>
    <product>
        <Name><![CDATA[G8]]></Name>
        <Brand><![CDATA[Sim32]]></Brand>
        <Price><![CDATA[143]]></Price>
        <Price><![CDATA[84]]></Price>
    </product>
</products>

我的最终 XML 如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<products>
    <product>
        <Name><![CDATA[G5]]></Name>
        <Brand><![CDATA[Sim]]></Brand>
        <Price><![CDATA[14]]></Price>
        <Price><![CDATA[8]]></Price>
        <Type><![CDATA[44214]]></Type>
    </product>
    <product>
        <Name><![CDATA[G8]]></Name>
        <Brand><![CDATA[Sim32]]></Brand>
        <Price><![CDATA[143]]></Price>
        <Price><![CDATA[84]]></Price>
        <Type><![CDATA[44]]></Type>
    </product>
</products>

这是我正在使用的代码:

    Dim objTextReaderOriginal As XmlTextReader = New XmlTextReader("original.xml")
    Dim objTextReaderToAppend As XmlTextReader = New XmlTextReader("to_append.xml")

    Dim dsOriginal As DataSet = New DataSet()
    Dim dsToAppend As DataSet = New DataSet()

    dsOriginal.ReadXml(objTextReaderOriginal)
    dsToAppend.ReadXml(objTextReaderToAppend)

    dsOriginal.Merge(dsToAppend)

    dsOriginal.WriteXml("complete.xml")

错误发生在这一行:dsOriginal.Merge(dsToAppend)

4

0 回答 0