Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2006, 05:30 AM
Registered User
 
Join Date: May 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert 1 big XML to multiple smaller XML victorcorey XSLT 1 March 20th, 2008 05:59 AM
Convert XML to XML template question bonekrusher XSLT 3 July 12th, 2007 07:47 AM
convert XML to XMl - Another Namespace question bonekrusher XSLT 2 July 10th, 2007 07:32 AM
Problem with convert dataset to xml ram_kimi ASP.NET 1.0 and 1.1 Professional 0 May 19th, 2006 06:50 AM
Getting XML from DataSet monuindia2002 XML 1 March 19th, 2006 07:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.