[
IsCompleted ](system.iasyncresult.iscompleted?view=dotnet-plat-ext-8.0)
property of the [ IAsyncResult ](system.iasyncresult?view=dotnet-plat-ext-8.0)
returned by the [ BeginExecuteNonQuery
](system.data.sqlclient.sqlcommand.beginexecutenonquery?view=dotnet-plat-
ext-8.0) method; or wait for the completion of one or more commands using the
[ AsyncWaitHandle ](system.iasyncresult.asyncwaithandle?view=dotnet-plat-
ext-8.0) property of the returned [ IAsyncResult
](system.iasyncresult?view=dotnet-plat-ext-8.0) .

If you use [ ExecuteReader
](system.data.sqlclient.sqlcommand.executereader?view=dotnet-plat-ext-8.0) or
[ BeginExecuteReader
](system.data.sqlclient.sqlcommand.beginexecutereader?view=dotnet-plat-
ext-8.0) to access XML data, SQL Server 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)

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) and retrieves one
or more result sets from the server, given a callback procedure and state
information.

    
    
    public:
     IAsyncResult ^ BeginExecuteReader(AsyncCallback ^ callback, System::Object ^ stateObject);
    
    
    public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject);
    
    
    member this.BeginExecuteReader : AsyncCallback * obj -> IAsyncResult
    
    
    Public Function BeginExecuteReader (callback As AsyncCallback, stateObject As Object) 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.

####  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 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 [ Stre