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

Re: Generating the correct XML from a self-referential table by Val

Val
Tue May 03 17:44:18 CDT 2005

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

--
Val Mazur
Microsoft MVP

http://xport.mvps.org



" Bob" <bobatkpmg@yahoo.com> wrote in message
news:%23KiG7f5TFHA.2768@tk2msftngp13.phx.gbl...
>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
>
>