Generating the correct XML from a self-referential table

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have a need to generate an XML based on a table in the DB. The table
contains self-referential data, e.g. it has these columns

employee_id
employee_name
employee_level
manager_id

manager_id is a foreign key to the employee_id. There can be many levels
of this relationships. How can I generate an XML document with the correct
hierarchy reflected? Since the levels are not known beforehand, I can't use
FOR XML clause in the SELECT statement. And a DataRelation with parent and
child from the same DataTable is not allowed in a DataSet.

Thanks a lot
Bob
 
Hi Bob,

If you need something nested, then you could load data into dataSet and than
save this dataSet into XML together with the relations
 
Back
Top