Problem in convert Dataset to XML
Hi all
i have a problem while converting dataset into xml
My XML format is
<test>
<date>10-02-2006</date>
<time>11.00 AM</time>
<tranCount>4</tranCount>
<tranDetail>
<tranID>001</tranID>
<tranID>002</tranID>
<tranID>003</tranID>
<tranID>004</tranID>
</tranDetail>
</test>
<test> , <tranDetail> are two table
and i use stored procedure to populate tha dataset
stored procedure returns 2 tables as output.
and my problem is, when i try to convert it as xml
it displays output like this
<test>
<date>10-02-2006</date>
<time>11.00 AM</time>
<tranCount>4</tranCount>
<tranDetail>
<tranID>001</tranID>
</tranDetail>
</test>
<tranDetail>
<tranID>002</tranID>
</tranDetail>
<tranDetail>
<tranID>003</tranID>
</tranDetail>
<tranDetail>
<tranID>001</tranID>
</tranDetail>
the first <trandetail> table is inserted within test sucessfully but remaining are come out of <test>
demoDS --> get results from stored proc
i = demoDS.Tables(0).Rows.Count
While i > 0
dr1 = _outputDS.Tables("test").NewRow
dr1("date") = demoDS.Tables(0).Rows(i - 1).Item(0)
dr1("time") = demoDS.Tables(0).Rows(i - 1).Item(1)
dr1("tranCount") = demoDS.Tables(0).Rows(i - 1).Item(2)
_outputDS.Tables("test").Rows.Add(dr1)
i = i - 1
End While
Dim dr, drx As DataRow
i = demoDS.Tables(1).Rows.Count
While i > 0
dr = _outputAuditDS.Tables("tranDetail").NewRow
dr("tranID") = demoDS.Tables(1).Rows(i - 1).Item(0)
_output.Tables("tranDetail").Rows.Add(dr)
i = i - 1
End While
this is my code to form the xml file..
i thought the problem is in second while loop.
Please anyone help me to fix this
Ram
====
Ram
|