XML scheme that causing crashing of the dataset

When i am converting a XML having the following elements in the body:
<ROOT>
...
<ITEMS>
<ITEM attr1="value" attr2="value"/>
<ITEM attr1="value2" attr2="value2"/>
</ITEMS>
...
</ROOT>
to dataset an artificiant key is created for the table ITEMS which connects it to the table ITEM.
However, when i continue working with the dataset it display an error than a constraint is missing.
What is a correct way to handle such XML in the dataset in the condition i want to be able to work with tables in the type-safe manner (.NET 2.0) and see them in the design time



Answer this question

XML scheme that causing crashing of the dataset

  • John Blight

    Hi Minherz,

    Initially I think you should design your dataset visually. That means create the object and in the surface add a DataTable and then load the xml in that dataset as normal.

    In the visual design, you should create the primary key -if you need it - and any other constraint that you need.

    Best Regards



  • Videe

    Thank you for your response.
    This idea is not working in the case of the above XML as an example. When you create a DataTable and starting defining columns the generated code sets up MappingType.Element enumeration value for a DataColumn constructor. I did not find where i can change this behavior. In the case this is happening the call to LoadXML fails to load the XML.

    Do you know a solution for it I failed to find one but discovered that generating a DataSet from the XSL file solves it. And it has its own drawback defined in this thread.


  • XML scheme that causing crashing of the dataset