SqlCommand::ExecuteXmlReader Method ()
Assembly: System.Data (in System.Data.dll)
An exception occurred while executing the command against a locked row. This exception is not generated when you are using Microsoft .NET Framework version 1.0.
A timeout occurred during a streaming operation. For more information about streaming, see SqlClient Streaming Support.
The CommandText property ordinarily specifies a Transact-SQL statement with a valid FOR XML clause. However, CommandText can also specify a statement that returns ntext or nvarchar data that contains valid XML, or the contents of a column defined with the xml data type.
A typicalquery can be formatted as in the following Microsoft Visual C# example:
SqlCommand command = new SqlCommand("SELECT * FROM dbo.Customers FOR XML AUTO, XMLDATA", SqlConn);
This method can also be used to retrieve a single-row, single-column result set that contains XML data. In this case, if more than one row is returned, the XmlReader to the value on the first row, and discards the rest of the result set.method attaches the
The multiple active result set (MARS) feature allows for multiple actions using the same connection.
If you use ExecuteReader or BeginExecuteReader to access XML data, SQL Server will return any XML results greater than 2,033 characters in length in multiple rows of 2,033 characters each. To avoid this behavior, use or BeginExecuteXmlReader to read FOR XML queries. For more information, see article Q310378, "PRB: XML Data Is Truncated When You Use SqlDataReader," in the Microsoft Knowledge Base at http://support.microsoft.com.
Available since 1.1