SqlCommand::ExecuteReader Method (CommandBehavior)
Assembly: System.Data (in System.Data.dll)
A timeout occurred during a streaming operation. For more information about streaming, see SqlClient Streaming Support.
When the CommandType property is set to StoredProcedure, the CommandText property should be set to the name of the stored procedure. The command executes this stored procedure when you call ExecuteReader.
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 ExecuteXmlReader 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.
The following example creates a SqlCommand, and then executes it by passing a string that is a Transact-SQL SELECT statement, and a string to use to connect to the data source. CommandBehavior is set to CloseConnection.