Send feedback on this topic.
Teradata.Client.Provider
ReadAsync(CancellationToken) Method



Teradata.Client.Provider Namespace > TdDataReader Class > ReadAsync Method : ReadAsync(CancellationToken) Method
A Threading.CancellationToken used to indicate that the asynchronous operation should be canceled.
Advances the data reader to the next record / row asynchronously.
Syntax
'Declaration
 
Public Overloads Overrides NotOverridable Function ReadAsync( _
   ByVal cancellationToken As CancellationToken _
) As Task(Of Boolean)
'Usage
 
Dim instance As TdDataReader
Dim cancellationToken As CancellationToken
Dim value As Task(Of Boolean)
 
value = instance.ReadAsync(cancellationToken)
public override Task<bool> ReadAsync( 
   CancellationToken cancellationToken
)
public:
Task<bool>^ ReadAsync( 
   CancellationToken cancellationToken
) override 

Parameters

cancellationToken
A Threading.CancellationToken used to indicate that the asynchronous operation should be canceled.

Return Value

Returns a Task<Boolean> with a value of true if the reader is advanced to the next record, or false if the end of the result set is reached.
Exceptions
ExceptionDescription
The TdDataReader is closed.
The TdConnection is closed, or there is already an Asynchronous method in progress.
Remarks

TdDataReader is conceptually a static forward-only cursor. ReadAsync method advances the current position by one record. When data reader is first created, or when the NextResult method is called, the current position is set prior to the first record. Therefore, you must call the ReadAsync method to get access to the first record and subsequent records. This maintains consistent semantics throughout the interface at all times.

If you cancel this function it will leave the Data Reader in an invalid state. Only Dispose() should be called after cancelling this function.

If this function generates a runtime exception that exception will be wrapped within a AggregateException within the returned Task:

Exception Description
OperationCanceledException The asynchronous operation was canceled.
TdException The Teradata Database returned an error, or .NET Data Provider for Teradata detected an error.
Requirements

Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

See Also

Reference

TdDataReader Class
TdDataReader Members
Overload List