Hi
As Alexey has suggested, after you create the XmlReader from SqlXml
instance, you can call its "Read()" method to read into the underlying XML
stream. Also, you need to first call "Read" method on the SqlDataReader you
get so as to move to the first returned record:
e.g.
================
using (SqlCommand command =
connection.CreateCommand())
{
command.CommandType = CommandType.Text;
command.CommandText = sql;
command.Parameters.AddRange(sqlParams);
connection.Open();
using (SqlDataReader dr =
command.ExecuteReader())
{
if (dr.Read())
document.Load(
dr.GetSqlXml(0).CreateReader());
}
connection.Close();
}
===========================
Here are some web articles discussing on this:
#XML Data Type Support in ADO.NET 2.0: Handling XML from SQL Server 2005
http://msdn2.microsoft.com/en-us/library/ms971534.aspx
#XML Data type in ADO.Net v2.0 - Part II
http://blogs.msdn.com/sushilc/rss_ta...taType+w_2F00_
ADO.Net+2.0.xml
#Work with XML Data Type in SQL Server 2005 from ADO.NET 2.0
http://www.developer.com/net/net/art...1087_3406251_3
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.