>From a previous post of mine on the asp 15seconds list:

You can use a CROSS JOIN for that.  Here is a simplistic way to do this:

select
    "tables"."xml"
    , "table"."name"
    , "column"."name"
from
    sysobjects "table"
inner join
    syscolumns "column" on "table"."id" = "column"."id"
cross join
    (SELECT null "xml") "tables"
where
    "table"."id" < 3
for xml auto


What are you doing in GetResultOfStoredProc?  You could just append this
data as a node to your new XmlDocument (after you do things like add a
processing instruction and a root element).

David L. Penton, Microsoft MVP
JCPenney Application Specialist / Lead
"Mathematics is music for the mind, and Music is Mathematics for the
Soul. - J.S. Bach"
[EMAIL PROTECTED]

Do you have the VBScript Docs or SQL BOL installed?  If not, why not?
VBScript Docs: http://www.davidpenton.com/vbscript
SQL BOL: http://www.davidpenton.com/sqlbol


-----Original Message-----
From: Todd Pull [mailto:[EMAIL PROTECTED]]

I have a stored proc in SQL Server 2000 that returns data in an xml
structure.  I was hoping that I could read the results directly into an xml
document in ASP.Net

Such as -------

1)
Select Date,Time,Vendor,Amount From History For Xml Auto, Elements

2) ASP.Net page

 SqlDataReader SqlDataResults = GetResultofStoredProc;

    xmlOutPut = new XmlDocument(); //create XmlDoc

    xmlOutPut.LoadXml(SqlDataResults.ToString()); //Load XML from stored
//proc into XMLDoc


The error I'm getting is: "System.Xml.XmlException: There is invalid data at
the root level. Line 1, position 1"

I guess that is because the XML returned via the stored procedure does not
have a root element.

Not sure how to get the root element in place?

TIA,

Todd


---
You are currently subscribed to dotnet as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

---------
Administrated by 15 Seconds : http://www.15Seconds.com
List Archives/Search : http://local.15Seconds.com/search
Subscription Information : http://www.15seconds.com/listserv.htm
Advertising Information: http://www.internet.com/mediakit/


Reply via email to