willred
March 15th, 2006, 01:53 PM
Hello,
I've a problem to serialize my dataset.
this dataSet have 2 dataTable
Datatable contact and screeneamecontact.
screenamecontact is an child element of contact.
I've this result when I serialize my Dataset localconfig
<localconfig>
<contact />
<screenamecontact realname="toto" />
</localconfig>
But I want :
<localconfig>
<contact >
<screenamecontact realname="toto" /> Polo </screenamecontact>
</contact>
</localconfig>
I search in the msdn and it's the properties Nested = true
of my datarelation who alow me to have this xml.
To add a new row to my Datatable I do:
localCongig lc = new localConfig();
DataRow drContact = (localconfig.contactRow)lc.contact.NewcontactRow();
DataRow drScreename = localconfig.screenamecontactRow)lc.screenamecontact.NewscreenamecontactRow();
drScreename["realname"]= "toto";
lc.Relations["contact_screenamecontact"].Nested =true;
lc.Relations["contact_screenamecontact"].ChildTable.Rows.Add(drScreename);
/* i try to do that to */
lc.contact.ChildRelations["contact_screenamecontact"].ChildTable.Rows.Add(drScreename);
lc.contact.AddcontactRow((localconfig.contactRow)drContact);
lc.WriteXml(pathfile);
My problem come from my dataRelation or I do not create well my datarow screename?
Thanks for you're Help :=)
Here're you're my xsd :
<xs:element name="contact" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType>
<xs:sequence>
<xs:element name="screenamecontact" minOccurs="0">
<xs:complexType>
<xs:sequence />
<xs:attribute name="realname" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
I've a problem to serialize my dataset.
this dataSet have 2 dataTable
Datatable contact and screeneamecontact.
screenamecontact is an child element of contact.
I've this result when I serialize my Dataset localconfig
<localconfig>
<contact />
<screenamecontact realname="toto" />
</localconfig>
But I want :
<localconfig>
<contact >
<screenamecontact realname="toto" /> Polo </screenamecontact>
</contact>
</localconfig>
I search in the msdn and it's the properties Nested = true
of my datarelation who alow me to have this xml.
To add a new row to my Datatable I do:
localCongig lc = new localConfig();
DataRow drContact = (localconfig.contactRow)lc.contact.NewcontactRow();
DataRow drScreename = localconfig.screenamecontactRow)lc.screenamecontact.NewscreenamecontactRow();
drScreename["realname"]= "toto";
lc.Relations["contact_screenamecontact"].Nested =true;
lc.Relations["contact_screenamecontact"].ChildTable.Rows.Add(drScreename);
/* i try to do that to */
lc.contact.ChildRelations["contact_screenamecontact"].ChildTable.Rows.Add(drScreename);
lc.contact.AddcontactRow((localconfig.contactRow)drContact);
lc.WriteXml(pathfile);
My problem come from my dataRelation or I do not create well my datarow screename?
Thanks for you're Help :=)
Here're you're my xsd :
<xs:element name="contact" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType>
<xs:sequence>
<xs:element name="screenamecontact" minOccurs="0">
<xs:complexType>
<xs:sequence />
<xs:attribute name="realname" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>