Hi all.
I have the following DataSet:
Now, for some reason if I instantiate this (not filling it) DataSet (ds = New Structure), I can get to all three tables by using ds.Tables, but ds.Relations.Count = 0, even though there are three table references set. I need to be able to get the relationship information from this DataSet, so what am I doing wrong?
Any help is greatly appreciated.
Regards.
Stephen.
I have the following DataSet:
Code:
<xs:element name="Structure" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="INF_COMP">
<xs:complexType>
<xs:sequence>
<xs:element name="PK" type="xs:int" />
<xs:element name="FK" type="xs:int" minOccurs="0" />
<xs:element name="Field1" type="xs:string" minOccurs="0" />
<xs:element name="Field2" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="INF_PERS">
<xs:complexType>
<xs:sequence>
<xs:element name="PK" type="xs:int" />
<xs:element name="FK" type="xs:int" minOccurs="0" />
<xs:element name="Field1" type="xs:string" minOccurs="0" />
<xs:element name="Field2" type="xs:dateTime" minOccurs="0" />
<xs:element name="Field3" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="INF_FIN">
<xs:complexType>
<xs:sequence>
<xs:element name="PK" type="xs:int" />
<xs:element name="FK" type="xs:int" minOccurs="0" />
<xs:element name="Field1" type="xs:dateTime" minOccurs="0" />
<xs:element name="Field2" type="xs:string" minOccurs="0" />
<xs:element name="Field3" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="PK_COMP_PK" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:INF_COMP" />
<xs:field xpath="mstns:PK" />
</xs:key>
<xs:key name="PK_PERS_PK" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:INF_PERS" />
<xs:field xpath="mstns:PK" />
</xs:key>
<xs:key name="PK_FIN_PK" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:INF_FIN" />
<xs:field xpath="mstns:PK" />
</xs:key>
<xs:keyref name="RLTN_COMP_PERS" refer="PK_COMP_PK" msdata:ConstraintOnly="true" msdata:AcceptRejectRule="None"
msdata:DeleteRule="Cascade" msdata:UpdateRule="Cascade">
<xs:selector xpath=".//mstns:INF_PERS" />
<xs:field xpath="mstns:FK" />
</xs:keyref>
<xs:keyref name="RLTN_COMP_FIN" refer="PK_COMP_PK" msdata:ConstraintOnly="true" msdata:AcceptRejectRule="None"
msdata:DeleteRule="Cascade" msdata:UpdateRule="None">
<xs:selector xpath=".//mstns:INF_FIN" />
<xs:field xpath="mstns:FK" />
</xs:keyref>
<xs:keyref name="COMP_PARENTCOMP" refer="PK_COMP_PK" msdata:ConstraintOnly="true" msdata:AcceptRejectRule="None"
msdata:DeleteRule="SetNull" msdata:UpdateRule="SetNull">
<xs:selector xpath=".//mstns:INF_COMP" />
<xs:field xpath="mstns:FK" />
</xs:keyref>
</xs:element>
Any help is greatly appreciated.
Regards.
Stephen.