Kirk,
I tried to use maxOccurs (please see the xsd file below) by
saving the dataset to a XML file and then load it back. The
application did not raise any errors, even when the parent
row has more than two child records.
XSD File: -------------------
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="dsXP"
targetNamespace="
http://tempuri.org/dsXP.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns="
http://tempuri.org/dsXP.xsd"
xmlns:mstns="
http://tempuri.org/dsXP.xsd"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="dsXP" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="dsFoo">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:int" minOccurs="0"
msdata:AutoIncrement="true" msdata:AutoIncrementSeed="0"
msdata:AutoIncrementStep="1" />
<xs:element name="Name" type="xs:string"
minOccurs="0" />
<xs:element name="dsBar" maxOccurs="2">
<xs:complexType>
<xs:sequence>
<xs:element name="Caption" type="xs:string"
minOccurs="0" />
<xs:element name="ID" type="xs:int" minOccurs="0"
msdata:AutoIncrement="true" msdata:AutoIncrementSeed="0"
msdata:AutoIncrementStep="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="dsXPKey1" msdata
rimaryKey="true">
<xs:selector xpath=".//mstns:dsFoo" />
<xs:field xpath="mstns:ID" />
</xs:key>
<xs:key name="dsXPKey2" msdata
rimaryKey="true">
<xs:selector xpath=".//mstns:dsBar" />
<xs:field xpath="mstns:ID" />
</xs:key>
</xs:element>
</xs:schema>
END XSD --------------------------
How can I make the application raises an error when child
records count exceeds maxOccurs?
Thanks for your help
John Yung