Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

export dataset

i have a dataset that has two tables with a relationship defined between the two. Is there a way to export this to excel keeping the relationship so it would display in a subtotal format

This is for a web app

Thank you
0
jimseiwert
Asked:
jimseiwert
  • 3
  • 2
2 Solutions
 
VBRocksCommented:
DataSet.WriteXML()

0
 
jimseiwertAuthor Commented:
so how does that work with excel?
0
 
VBRocksCommented:
I'm so sorry.  I totally spaced it and stopped reading after "export", and didn't event catch "excel".  ;)

I don't know the answer to that.

What are you looking for as far as a "subtotal format"?

You can loop through each row of the parent DataTable, and call the row's GetChildRows(relationName)
method to retrieve all of the related rows, then write the Parent row, and each child row to Excel.

So it would (basically) be something like this in Excel:

parent row 1
     child row 1
     child row 2
     child row 3

parent row 2
     child row 1
     child row 2
     child row 3

etc...

Is that what you are referring to, or did you have something else in mind?

0
 
jimseiwertAuthor Commented:
no that is the format i was looking for, just need to do the code now, i will let you know how it works. If you have any examples that would be great
0
 
VBRocksCommented:
Take a look at the following link.  I think it will be of help to you:

    http://p2p.wrox.com/topic.asp?TOPIC_ID=31161

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now