|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Filling Dataset With a predefined XSDI wanted to query database and make an XML using WriteXML function in the dataset. When I use WriteXML function the XML structure is according to some default schema. I wanted the schema to be defined by me (given below). I tried using ReadSchema function before calling the fill function in the dataAdapter but that did not help can someone please advice Thanks in advance, Praveen <?xml version="1.0" standalone="yes"?> <xs:schema id="ROOT" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="ROOT" msdata:IsDataSet="true"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="I"> <xs:complexType> <xs:sequence> </xs:sequence> <xs:attribute name="NTID" type="xs:string" /> <xs:attribute name="U" type="xs:string" /> <xs:attribute name="T" type="xs:string" /> <xs:attribute name="PJNAM" type="xs:string" /> <xs:attribute name="SNDR" type="xs:string" /> <xs:attribute name="SDT" type="xs:string" /> <xs:attribute name="C" type="xs:string" /> <xs:attribute name="P" type="xs:string" /> <xs:attribute name="S" type="xs:string" /> <xs:attribute name="E" type="xs:string" /> <xs:attribute name="SID" type="xs:string" /> <xs:attribute name="ITMID" type="xs:string" /> <xs:attribute name="ITYP" type="xs:string" /> <xs:attribute name="PRTY" type="xs:string" /> <xs:attribute name="EDT" type="xs:string" /> <xs:attribute name="TYP" type="xs:string" /> <xs:attribute name="RUNR" type="xs:string" /> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> <xs:key name="ROOTKey1" msdata:PrimaryKey="true"> <xs:selector xpath=".//I" /> <xs:field xpath="@NTID" /> </xs:key> </xs:element> </xs:schema> Hi Praveen,
Thanks for pasting the schema here. This schema is a valid DataSet schema and we can write the xml with the desired schema. But we have to make sure whether the data has been filled to the 'I' Table. Please try to use XmlWriteMode.WriteSchema to output the data and schema together. You can check if the data is in the desired table. If you have any problem, please post the xml here. Thanks! Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights." Hello Kevin
I was able to get the desired result. there are 2 ways of doing this. One as you mentioned. and second is by making use of TableMapping like below. dbAdptr.TableMappings.Add("Table","I") The second approach is better because if we are calling a procedure returning multiple cursors we can handle this situation by setting the table mapping for each dataTable. Regards, Praveen Show quote "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message news:BPko0g2MGHA.668@TK2MSFTNGXA01.phx.gbl... > Hi Praveen, > > Thanks for pasting the schema here. This schema is a valid DataSet schema > and we can write the xml with the desired schema. But we have to make sure > whether the data has been filled to the 'I' Table. Please try to use > XmlWriteMode.WriteSchema to output the data and schema together. You can > check if the data is in the desired table. If you have any problem, please > post the xml here. Thanks! > > Kevin Yu > ======= > "This posting is provided "AS IS" with no warranties, and confers no > rights." > |
|||||||||||||||||||||||