Send feedback on this topic.
Teradata.Client.Provider
BeginExecuteReader(AsyncCallback,Object,CommandBehavior) Method



Teradata.Client.Provider Namespace > TdCommand Class > BeginExecuteReader Method : BeginExecuteReader(AsyncCallback,Object,CommandBehavior) Method
Delegate that will be invoked after the processing of the request has completed. If one is not required a null is specified.
User defined object. This object is available to the callback procedure by accessing the IAsyncResult.AsyncState property.
One of the Data.CommandBehavior enumerations values.
Initiates the asynchronous request that will use the specific CommandBehavior and retrieves one or more result sets from Teradata.
Syntax
'Declaration
 
Public Overloads Function BeginExecuteReader( _
   ByVal callback As AsyncCallback, _
   ByVal state As Object, _
   ByVal behavior As CommandBehavior _
) As IAsyncResult
'Usage
 
Dim instance As TdCommand
Dim callback As AsyncCallback
Dim state As Object
Dim behavior As CommandBehavior
Dim value As IAsyncResult
 
value = instance.BeginExecuteReader(callback, state, behavior)
public IAsyncResult BeginExecuteReader( 
   AsyncCallback callback,
   object state,
   CommandBehavior behavior
)
public:
IAsyncResult^ BeginExecuteReader( 
   AsyncCallback^ callback,
   Object^ state,
   CommandBehavior behavior
) 

Parameters

callback
Delegate that will be invoked after the processing of the request has completed. If one is not required a null is specified.
state
User defined object. This object is available to the callback procedure by accessing the IAsyncResult.AsyncState property.
behavior
One of the Data.CommandBehavior enumerations values.

Return Value

Returns a IAsyncResult object.
Exceptions
ExceptionDescription
Indicates the requested behavior is not supported.
Indicates the TdParameter.Offset is outside of 0 through array size � 1.
Indicates one or more parameters cannot be converted to Teradata native types.
Can be thrown because of one of the following errors: 1) TdConnection is not in Open state or is null. 2) The local transaction associated with TdCommand is not the same local transaction associated with the TdConnection --assign local transaction to TdCommand.Transaction property.
The TdCommand is closed / disposed.
Can be thrown because the Data Provider detected an error.
Remarks

The call to BeginExecuteReader returns after the request has been successfully sent to Teradata. Any exceptions that are generated by the provider while initializing the request will be thrown during the call to BeginExecuteReader. Exceptions that are generated by the provider or Teradata during the processing of the request will be thrown when TdCommand.EndExecuteReader is called.

The DDL statement CREATE PROCEDURE cannot be specified in an asynchronous execution. If it has been specified a TdException will be thrown when TdCommand.EndExecuteReader is called.

A connection can only have one active request. Therefore, if an asynchronous request is being processed by the provider an exception will be thrown when an attempt is made to start another asynchronous request.

The TdCommand.CommandTimeout property is not applicable to asynchronous execution and will be ignored when a command is asynchronously executed.

If behavior is Data.CommandBehavior.SchemaOnly, BeginExecuteReader will execute the command synchronously.

Refer to TdCommand.ExecuteReader for more information.

Example
See TdCommand.BeginExecuteReader for a coding example.
Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdCommand Class
TdCommand Members
Overload List