Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to create XML using DataSet having more then one table?

how to create XML using DataSet having more then one table?

Scheduled Pinned Locked Moved C#
helpxmltutorialquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sasmi_Office
    wrote on last edited by
    #1

    Dear Friend, I have four DataTable Name "Table 1", "Table 2", "Table 3" and "Table 4" this table contain two rows each as given below Data in "Table 1" ID 1 2 Data in "Table 2" ID Name 1 ABC 2 XYZ Data in "Table 3" ID Date 1 01/01/2009 2 02/01/2009 Data in "Table 4" ID Value 1 AAA 2 XXX This all table added in one DataSet related with each other using Relations with ID Column. Now when i create XML file using this DataSet it Gives me in sequence as given below. <?xml version="1.0" standalone="yes" ?> <Data Set> <Table 1> <ID>1</ID> </Table 1> <Table 1> <ID>2</ID> </Table 1> <Table 2> <Name>ABC</Name> </Table 2> <Table 2> <Name>XYZ</Name> </Table 2> <Table 3> <Date>01/01/2009</Date> </Table 3> <Table 3> <Date>02/01/2009</Date> </Table 3> <Table 4> <Value>AAA</Value> </Table 4> <Table 4> <Value>XXX</Value> </Table 4> </Data Set> The problem is the sequence i want the same data in following sequence <?xml version="1.0" standalone="yes" ?> <Data Set> <Table 1> <ID>1</ID> </Table 1> <Table 2> <Name>ABC</Name> </Table 2> <Table 3> <Date>01/01/2009</Date> </Table 3> <Table 4> <Value>AAA</Value> </Table 4> <Table 1> <ID>2</ID> </Table 1> <Table 2> <Name>XYZ</Name> </Table 2> <Table 3> <Date>02/01/2009</Date> </Table 3> <Table 4> <Value>XXX</Value> </Table 4> </Data Set> Is this Possible? or there is another way to do this? Please help me. Thanks and Regards in advance Sasmi

    D 1 Reply Last reply
    0
    • S Sasmi_Office

      Dear Friend, I have four DataTable Name "Table 1", "Table 2", "Table 3" and "Table 4" this table contain two rows each as given below Data in "Table 1" ID 1 2 Data in "Table 2" ID Name 1 ABC 2 XYZ Data in "Table 3" ID Date 1 01/01/2009 2 02/01/2009 Data in "Table 4" ID Value 1 AAA 2 XXX This all table added in one DataSet related with each other using Relations with ID Column. Now when i create XML file using this DataSet it Gives me in sequence as given below. <?xml version="1.0" standalone="yes" ?> <Data Set> <Table 1> <ID>1</ID> </Table 1> <Table 1> <ID>2</ID> </Table 1> <Table 2> <Name>ABC</Name> </Table 2> <Table 2> <Name>XYZ</Name> </Table 2> <Table 3> <Date>01/01/2009</Date> </Table 3> <Table 3> <Date>02/01/2009</Date> </Table 3> <Table 4> <Value>AAA</Value> </Table 4> <Table 4> <Value>XXX</Value> </Table 4> </Data Set> The problem is the sequence i want the same data in following sequence <?xml version="1.0" standalone="yes" ?> <Data Set> <Table 1> <ID>1</ID> </Table 1> <Table 2> <Name>ABC</Name> </Table 2> <Table 3> <Date>01/01/2009</Date> </Table 3> <Table 4> <Value>AAA</Value> </Table 4> <Table 1> <ID>2</ID> </Table 1> <Table 2> <Name>XYZ</Name> </Table 2> <Table 3> <Date>02/01/2009</Date> </Table 3> <Table 4> <Value>XXX</Value> </Table 4> </Data Set> Is this Possible? or there is another way to do this? Please help me. Thanks and Regards in advance Sasmi

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The only way to make that happen is to write your own serialization code for the dataset. Frankly, I wonder why every newbie who sees XML immediately thikns it's a database. It's not. XML is a data storage and transfer markup language. It is most assuredly NOT a good candidate for a database engine.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups