I think you want to use the SqlCommand.ExecuteXmlReader Method.

---
Patrick Steele ([EMAIL PROTECTED])
Lead Software Architect
Image Process Design


> -----Original Message-----
> From: Todd Pull [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 16, 2003 5:15 PM
> To: dotnet
> Subject: SQL Server xml and SQLDataReader
> 
> 
> 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?

---
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