Keith,
Far be it for me to provide an alternative to the industrious Oleg,
[Excellent contributions both here and on his weblog]
If you're not too concerned about performance and are trying to build a
hierarchical XML representation of some obvious SQL relationships it may be
easier to build 5 data adaptors, create the relationships and then extract
the XML.
By test code looks like...
Database connection string in strConn
Streamwriter in strmOutput
SqlConnection conn = new SqlConnection(strConn);
SqlDataAdapter dtaHolder = new SqlDataAdapter("Select * from LPS_HOLDER
where FIRST_NAME like '%cook%'",conn);
SqlDataAdapter dtaLocation = new SqlDataAdapter("Select * from
LPS_LOCATION",conn);
conn.Open();
DataSet dsHoldLoc = new DataSet("HolderLocation");
dtaHolder.Fill(dsHoldLoc,"Holders");
dtaLocation.Fill(dsHoldLoc, "Locations");
conn.Close();
DataRelation drHoldLoc = dsHoldLoc.Relations.Add("HoldLocs",
dsHoldLoc.Tables["Locations"].Columns["INITIAL_LOCATION_ID"],
dsHoldLoc.Tables["Holders"].Columns["INITIAL_LOCATION_ID"],false);
drHoldLoc.Nested = true;
dsHoldLoc.WriteXml(strmOutput);
strmOutput.Flush();
strmOutput.Close();
Stephen
"Keith Chadwick" <kc*******@leewardsystems.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
My problem is this. I have to create several xmlReader objects each
retrieving 'for xml' formatted sql server data. I then need to peice them
together into a single document and place them into a single XPathDocument
which is then transformed throughout the web site with different
XslTransformations. I realize that the Xpathdocument will accept a
XmlReader as an object but I have 5 of them so how to 'best' combine. The
resulting XpathDocument is placed into the Cache and is only updated twice
a day.
Cheers
Keith
Note: I do note have access to the SQLXML objects on the production ISP
site otherwise I would use them!