returns any XML results greater than
2,033 characters in length in multiple rows of 2,033 characters each. To avoid
this behavior, use [ ExecuteXmlReader
](system.data.sqlclient.sqlcommand.executexmlreader?view=dotnet-plat-ext-8.0)
or [ BeginExecuteXmlReader
](system.data.sqlclient.sqlcommand.beginexecutexmlreader?view=dotnet-plat-
ext-8.0) to read FOR XML queries.

This method ignores the [ CommandTimeout
](system.data.sqlclient.sqlcommand.commandtimeout?view=dotnet-plat-ext-8.0)
property.

###  See also

  * [ Connecting and Retrieving Data in ADO.NET ](/en-us/dotnet/framework/data/adonet/retrieving-and-modifying-data)
  * [ Using the .NET Framework Data Provider for SQL Server ](/en-us/dotnet/framework/data/adonet/sql/)
  * [ ADO.NET Overview ](/en-us/dotnet/framework/data/adonet/ado-net-overview)

###  Applies to

##  BeginExecuteReader(AsyncCallback, Object, CommandBehavior)

Initiates the asynchronous execution of the Transact-SQL statement or stored
procedure that is described by this [ SqlCommand
](system.data.sqlclient.sqlcommand?view=dotnet-plat-ext-8.0) , using one of
the ` CommandBehavior ` values, and retrieving one or more result sets from
the server, given a callback procedure and state information.

    
    
    public:
     IAsyncResult ^ BeginExecuteReader(AsyncCallback ^ callback, System::Object ^ stateObject, System::Data::CommandBehavior behavior);
    
    
    public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject, System.Data.CommandBehavior behavior);
    
    
    member this.BeginExecuteReader : AsyncCallback * obj * System.Data.CommandBehavior -> IAsyncResult
    
    
    Public Function BeginExecuteReader (callback As AsyncCallback, stateObject As Object, behavior As CommandBehavior) As IAsyncResult

####  Parameters

callback

     [ AsyncCallback ](system.asynccallback?view=dotnet-plat-ext-8.0)

An [ AsyncCallback ](system.asynccallback?view=dotnet-plat-ext-8.0) delegate
that is invoked when the command's execution has completed. Pass ` null ` ( `
Nothing ` in Microsoft Visual Basic) to indicate that no callback is required.

stateObject

     [ Object ](system.object?view=dotnet-plat-ext-8.0)

A user-defined state object that is passed to the callback procedure. Retrieve
this object from within the callback procedure using the [ AsyncState
](system.iasyncresult.asyncstate?view=dotnet-plat-ext-8.0#system-iasyncresult-
asyncstate) property.

behavior

     [ CommandBehavior ](system.data.commandbehavior?view=dotnet-plat-ext-8.0)

One of the [ CommandBehavior ](system.data.commandbehavior?view=dotnet-plat-
ext-8.0) values, indicating options for statement execution and data
retrieval.

####  Returns

[ IAsyncResult ](system.iasyncresult?view=dotnet-plat-ext-8.0)

An [ IAsyncResult ](system.iasyncresult?view=dotnet-plat-ext-8.0) that can be
used to poll or wait for results, or both; this value is also needed when
invoking [ EndExecuteReader(IAsyncResult)
](system.data.sqlclient.sqlcommand.endexecutereader?view=dotnet-plat-
ext-8.0#system-data-sqlclient-sqlcommand-endexecutereader\(system-
iasyncresult\)) , which returns a [ SqlDataReader
](system.data.sqlclient.sqldatareader?view=dotnet-plat-ext-8.0) instance which
can be used to retrieve the returned rows.

####  Exceptions

[ InvalidCastException ](system.invalidcastexception?view=dotnet-plat-ext-8.0)

A [ SqlDbType ](system.data.sqlclient.sqlparameter.sqldbtype?view=dotnet-plat-
ext-8.0#system-data-sqlclient-sqlparameter-sqldbtype) other than **Binary** or
**VarBinary** was used when [ Value
](system.data.sqlclient.sqlparameter.value?view=dotnet-plat-ext-8.0#system-
data-sqlclient-sqlparameter-value) was set to [ Stream
](system.io.stream?view=dotnet-plat-ext-8.0) . For more information about
streaming, see [ SqlClient Streaming Support ](/en-
us/dotnet/framework/data/adonet/sqlclient-streaming-support) .

-or- 

A [ SqlDbType ](system.data.sqlclient.sqlparameter.sqldbtype?view=dotnet-plat-
ext-8.0#system-data-sqlcl