O, XMLDATA", SqlConn);
    

This method can also be used to retrieve a single-row, single-column result
set. In this case, if more than one row is returned, the ` EndExecuteXmlReader
` method attaches the [ XmlReader ](system.xml.xmlreader?view=dotnet-plat-
ext-8.0) to the value on the first row, and discards the rest of the result
set.

The multiple active result set (MARS) feature lets multiple actions use the
same connection.

Note that the command text and parameters are sent to the server
synchronously. If a large command or many parameters are sent, this method may
block during writes. After the command is sent, the method returns immediately
without waiting for an answer from the server--that is, reads are
asynchronous. Although command execution is asynchronous, value fetching is
still synchronous.

Because this overload does not support a callback procedure, developers need
to either poll to determine whether the command has completed, using the [
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 [ BeginExecuteXmlReader
](system.data.sqlclient.sqlcommand.beginexecutexmlreader?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

##  BeginExecuteXmlReader(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 returns
results as an [ XmlReader ](system.xml.xmlreader?view=dotnet-plat-ext-8.0)
object, using a callback procedure.

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