Gemstone Data Library
Show/Hide TOC

# DataExtensionsTryRetrieveRowAsync(DbCommand, String, Int32, CancellationToken, Object) Method

Tries to retrieve the first DataRow in the result set of the SQL statement using DbCommand.

## Definition

Namespace: Gemstone.Data.DataExtensions
Assembly: Gemstone.Data (in Gemstone.Data.dll) Version: 1.0.159 -- Release Build+9666939f99852a601f77d33e6f63320df255766c
C#
View Source Request Example

    public static Task<(DataRow row, bool )> TryRetrieveRowAsync(
    	this DbCommand command,
    	string sql,
    	int timeout,
    	CancellationToken cancellationToken,
    	params Object?[] parameters
    )

VB
View Source Request Example

    <ExtensionAttribute>
    Public Shared Function TryRetrieveRowAsync (
    	command As DbCommand,
    	sql As String,
    	timeout As Integer,
    	cancellationToken As CancellationToken,
    	ParamArray parameters As Object()
    ) As Task(Of (row As DataRow,  As Boolean))

C++
View Source Request Example

    public:
    [ExtensionAttribute]
    static Task<ValueTuple<DataRow^, bool>>^ TryRetrieveRowAsync(
    	DbCommand^ command,
    	String^ sql,
    	int timeout,
    	CancellationToken cancellationToken,
    	... array<Object^>^ parameters
    )

JavaScript
View Source Request Example

    Gemstone.Data.DataExtensions.DataExtensions.TryRetrieveRowAsync = function(command, sql, timeout, cancellationToken, ... parameters);

#### Parameters

command DbCommand
  The DbCommand to use for executing the SQL statement.
sql String
  The SQL statement to be executed.
timeout Int32
  The time in seconds to wait for the SQL statement to execute.
cancellationToken CancellationToken
  Propagates notification that operations should be canceled.
parameters Object
  The parameter values to be used to fill in DbParameter parameters identified by '@' prefix in sql expression.

#### Return Value

Task ValueTuple DataRow, Boolean
Tuple of first DataRow in the result set (can be null) and a flag that determines if retrieve was successful.

#### Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DbCommand. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

## See Also

#### Reference

DataExtensions Class
TryRetrieveRowAsync Overload
Gemstone.Data.DataExtensions Namespace