Getting System.ArgumentException after loading xml into an Dataset

M

Markus Heid

Hi,

I've got an application in which I transform some semicolon separated
information into xml and then load it into a dataset: The XSD for the XML

Looks this way:

<?xml version="1.0" standalone="yes" ?>

<xs:schema id="trace" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<xs:element name="trace" msdata:IsDataSet="true">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element name="filter">

<xs:complexType>

<xs:sequence>

<xs:element name="dtsbegin" minOccurs="0"
maxOccurs="unbounded">

<xs:complexType>

<xs:attribute name="dts" type="xs:dateTime" />

</xs:complexType>

</xs:element>

<xs:element name="dtsend" minOccurs="0" maxOccurs="unbounded">

<xs:complexType>

<xs:attribute name="dts" type="xs:dateTime" />

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="errors">

<xs:complexType>

<xs:sequence>

<xs:element name="error" minOccurs="0" maxOccurs="unbounded">

<xs:complexType>

<xs:attribute name="dts" type="xs:dateTime" />

<xs:attribute name="category" type="xs:string" />

<xs:attribute name="module" type="xs:string" />

<xs:attribute name="device" type="xs:string" />

<xs:attribute name="message" type="xs:string" />

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

</xs:element>

</xs:schema>



This works well. The XML is filled with valid information. But when I quit
my program I get in 9 from 10 times following exception:



An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll



Additional information: Relation errors_error does not belong to this
DataSet.



This is my code for loading the xml into the dataset:



XmlTextReader xr = new XmlTextReader( sb.ToString(), XmlNodeType.Document,
null );

DataSet xmlSet = new DataSet();

xmlSet.ReadXmlSchema( "d:\\xsd\\opresolve.xsd" );



xmlSet.ReadXml( xr );

//xmlSet.WriteXmlSchema( ".\\opresolve.xsd" );

return( xmlSet );



Has anyone an idea what could be wrong?



Thanks in Advance





Dipl-Inf(FH)

Markus Heid



LogASys mbH

Georg-Mayr-Str 9

97828 Marktheidenfeld



Tel.: 09391/9896-616

Web: www.logasys.de



P.S I'm using VS 2003 with the 1.1 Framework
 
M

Markus Heid

Damn outlook express,
when I wrote the post it had a much more better format. Outlook express must
have destroyed it whens ending it.

sorry

markus
 
M

Miha Markic

Hi Markus,

The code you provided works just fine for me.
Did you try just reading your dataset and closing app? Does error happen?
Are you manipulating the dataset after loading it? etc.
 
M

Markus Heid

the dataset will be set as a datasource for a Crystal Report Viewer.
I'm using crystal reports 9 dev edition
 
M

Markus Heid

you are right. I had to nullify the datasource-property of the report object
before the application quits.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top