FOR XML returns XML data as a single-field text result with as many
rows required to contain all the data. It may be more than one row
and thus Rows[0][0] and ExecuteScalar will both truncate the data.
SqlCommand has a SQL-Server specific method ExecuteXmlReader designed
to handle FOR XML results.
HTH,
Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Tue, 12 Dec 2006 14:34:26 -0500, "Charlie@CBFC"
<ch*****@cbfconsulting.comwrote:
>Hi:
I have a stored proc that returns an XML doc. Testing it in Query Analyzer,
it looks fine. However consuming it in C# application truncates xml string
when result is converted to string from an ExecuteScalar data command. May
have something with string conversion because looking at result in a
datatable column looks OK, but when converting (tbl.Rows[0][0].String()) it
gets truncated. Why?
Thanks,
Charlie