lies to

##  BeginExecuteReader(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 ](system.data.commandbehavior?view=dotnet-plat-ext-8.0)
values.

    
    
    public:
     IAsyncResult ^ BeginExecuteReader(System::Data::CommandBehavior behavior);
    
    
    public IAsyncResult BeginExecuteReader (System.Data.CommandBehavior behavior);
    
    
    member this.BeginExecuteReader : System.Data.CommandBehavior -> IAsyncResult
    
    
    Public Function BeginExecuteReader (behavior As CommandBehavior) As IAsyncResult

####  Parameters

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, 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 that
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-sqlclient-sqlparameter-sqldbtype) other than **Char** ,
**NChar** , **NVarChar** , **VarChar** , or **Xml** was used when [ Value
](system.data.sqlclient.sqlparameter.value?view=dotnet-plat-ext-8.0#system-
data-sqlclient-sqlparameter-value) was set to [ TextReader
](system.io.textreader?view=dotnet-plat-ext-8.0) .

-or- 

A [ SqlDbType ](system.data.sqlclient.sqlparameter.sqldbtype?view=dotnet-plat-
ext-8.0#system-data-sqlclient-sqlparameter-sqldbtype) other than **Xml** was
used when [ Value ](system.data.sqlclient.sqlparameter.value?view=dotnet-plat-
ext-8.0#system-data-sqlclient-sqlparameter-value) was set to [ XmlReader
](system.xml.xmlreader?view=dotnet-plat-ext-8.0) .

[ SqlException ](system.data.sqlclient.sqlexception?view=dotnet-plat-ext-8.0)

Any error that occurred while executing the command text.

-or- 

A timeout occurred during a streaming operation. For more information about
streaming, see [ SqlClient Streaming Support ](/en-
us/dotnet/framework/data/adonet/sqlclient-streaming-support) .

[ InvalidOperationException ](system.invalidoperationexception?view=dotnet-
plat-ext-8.0)

The name/value pair "Asynchronous Processing=true" was not included within the
connection string defining the connection for this [ SqlCommand
](system.data.sqlclient.sqlcommand?view=dotnet-plat-ext-8.0) .

-or- 

The [ SqlConnection ](system.data.sqlclient.sqlconnection?view=dotnet-plat-
ext-8.0) closed or dropped during a streaming operation. For more information
about streaming, see [ SqlClient Streaming Support ](/en-
us/dotnet/framework/data/adonet/sqlclient-streaming-support) .

[ IOException ](system.io.ioexception?view=dotnet-plat-ext-8.0)

An error occurred in a [ Stream ](system.io.strea