Link to home
Start Free TrialLog in
Avatar of lytung818
lytung818

asked on

exporting xml from dataset

Is this xml format possible to create from a dataset writeXML method? I haven't been able to create multiple tables to look like this:

 <document>
  <employee>
    <name>
      <lastname>Kelly</lastname>
      <firstname>Grace</firstname>
    </name>
    <hiredate>October 15, 2005</hiredate>
    <projects>
      <project>
        <product>Printer</product>
        <id>111</id>
        <price>$111.00</price>
      </project>
      <project>
        <product>Laptop</product>
        <id>222</id>
        <price>$989.00</price>
      </project>
    </projects>
  </employee>
</document>
ASKER CERTIFIED SOLUTION
Avatar of sagacitysolutions
sagacitysolutions
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lytung818
lytung818

ASKER

Thanks so much for the reply. I have been sorta working on the first part similar to what you have..however i am having trouble adding the rows. I dont want to hardcode the rows since i dont know how many there could be. I tried something like this, and it didn't work :

  Dim i As Integer = intCounter
            Dim rowName As DataRow

            rowName = Table2.NewRow()
            rowName.Item(intCounter) = datafield
            Table2.Rows.Add(rowName)

            intCounter = intCounter + 1

also, what do the relations do?
It defines the relationship between the tables within the dataset

What error are you getting?
NO error. I just needed an example on how this would work. I tried it and it woked fine, however i dont want to hardcode the rows.