E
Ed
I've created a .XSD XML schema (see below) with 2 tables and a
relation defined between those tables. When I read the schema and XML
data into the dataset I can see and access the datatables, but the
dataset.relations collection is empty. If someone could help me get
this to work, explain why it won't, and/or give me a workaround, I
would appreciate it.
(FYI, I'm attempting to use this in a VB.NET Windows Forms application
to store application & config info. I'd like to be able to call
Datatable.GetChildRows() using the relation.)
Here's a snippet of the VB.NET code:
'Notes: "XMLConfigSchema" & "XMLConfigData" are const containing
file/path info
'"HCMgmt.HC_Computers" is the Dataset object created by the XSD in my
VS solution
dsConfig = New HCMgmt.HC_Computers
dsConfig.ReadXmlSchema(XMLConfigSchema)
dsConfig.ReadXml(XMLConfigData)
Here's the .XSD XML Schema:
(Note that this was created in VS.NET 2003 using the XML designer.)
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="HC_Computers"
targetNamespace="http://tempuri.org/HC_Computers.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/HC_Computers.xsd"
xmlns:mstns="http://tempuri.org/HC_Computers.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="ComputerInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="DisplayName" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="ComputerInfoKey1" msdatarimaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="mstnsisplayName" />
</xs:key>
</xs:element>
<xs:element name="AccessInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="DisplayName" type="xs:string" />
<xs:element name="IPorName" type="xs:string" />
<xs:element name="ID" type="xs:string" />
<xs:element name="PW" type="xs:string" />
<xs:element name="Domain" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="AccessInfoKey1">
<xs:selector xpath="." />
<xs:field xpath="mstnsisplayName" />
</xs:key>
<xs:keyref name="ComputerInfoComputerInfo" refer="ComputerInfoKey1"
msdataeleteRule="Cascade"
msdata:UpdateRule="Cascade">
<xs:selector xpath="." />
<xs:field xpath="mstnsisplayName" />
</xs:keyref>
</xs:element>
</xs:schema>
relation defined between those tables. When I read the schema and XML
data into the dataset I can see and access the datatables, but the
dataset.relations collection is empty. If someone could help me get
this to work, explain why it won't, and/or give me a workaround, I
would appreciate it.
(FYI, I'm attempting to use this in a VB.NET Windows Forms application
to store application & config info. I'd like to be able to call
Datatable.GetChildRows() using the relation.)
Here's a snippet of the VB.NET code:
'Notes: "XMLConfigSchema" & "XMLConfigData" are const containing
file/path info
'"HCMgmt.HC_Computers" is the Dataset object created by the XSD in my
VS solution
dsConfig = New HCMgmt.HC_Computers
dsConfig.ReadXmlSchema(XMLConfigSchema)
dsConfig.ReadXml(XMLConfigData)
Here's the .XSD XML Schema:
(Note that this was created in VS.NET 2003 using the XML designer.)
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="HC_Computers"
targetNamespace="http://tempuri.org/HC_Computers.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/HC_Computers.xsd"
xmlns:mstns="http://tempuri.org/HC_Computers.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="ComputerInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="DisplayName" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="ComputerInfoKey1" msdatarimaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="mstnsisplayName" />
</xs:key>
</xs:element>
<xs:element name="AccessInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="DisplayName" type="xs:string" />
<xs:element name="IPorName" type="xs:string" />
<xs:element name="ID" type="xs:string" />
<xs:element name="PW" type="xs:string" />
<xs:element name="Domain" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="AccessInfoKey1">
<xs:selector xpath="." />
<xs:field xpath="mstnsisplayName" />
</xs:key>
<xs:keyref name="ComputerInfoComputerInfo" refer="ComputerInfoKey1"
msdataeleteRule="Cascade"
msdata:UpdateRule="Cascade">
<xs:selector xpath="." />
<xs:field xpath="mstnsisplayName" />
</xs:keyref>
</xs:element>
</xs:schema>