Class AdbCommand
An Adb command with an SQL statement or stored procedure and parameters to execute
against a data source, similar to a DbAdbCommandBuilder Create()
method or by AdbConnection Create
Information about the data source and the provider can be found via the Connection property.
The command must be disposed after use. See Disposing Disposables for details.
Implements
Namespace: actionETL.Adb
Assembly: actionETL.dll
Syntax
public sealed class AdbCommand : IDisposable
Remarks
Do design database workers to take AdbConnectionString,
IAdbConnectionBuilder, and AdbCommandBuilder instances as parameters, which allows
them to support connections with different AdbAdbConnection, AdbKeepOpenConnection, AdbCommand,
or connection (text) strings to workers.
Properties
CommandText
Gets or sets the command text to execute.
Declaration
public string CommandText { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
CommandTimeout
Gets or sets the command timeout, in seconds.
Declaration
public int CommandTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
CommandType
Gets or sets the command type.
Declaration
public CommandType CommandType { get; set; }
Property Value
| Type | Description |
|---|---|
| Command |
Default is |
Connection
Gets the Adb database connection.
Declaration
public IAdbConnection Connection { get; }
Property Value
| Type | Description |
|---|---|
| IAdb |
Parameters
Gets the Adb parameter collection, for creating, adding and inspecting the command database parameters.
Declaration
public AdbParameterCollection Parameters { get; }
Property Value
| Type | Description |
|---|---|
| Adb |
Transaction
Gets or sets an Adb
Declaration
public AdbTransaction Transaction { get; set; }
Property Value
| Type | Description |
|---|---|
| Adb |
The transaction, or |
UnderlyingCommand
Gets the underlying .NET DbCommand.
Note: Always use the members on AdbCommand, where available. In rare cases however, the
underlying .NET DbCommand is needed, e.g. when accessing provider-specific
functionality not covered by AdbCommand.
Declaration
public DbCommand UnderlyingCommand { get; }
Property Value
| Type | Description |
|---|---|
| Db |
Methods
Cancel()
Cancels the command if possible.
Declaration
public void Cancel()
Dispose()
Dispose the instance. If this command 'owns' (i.e. it created) the associated connection, also dispose the connection.
Declaration
public void Dispose()
ExecuteNonQuery()
Executes Command
Declaration
public int ExecuteNonQuery()
Returns
| Type | Description |
|---|---|
| Int32 | The number of rows affected. |
Exceptions
| Type | Condition |
|---|---|
| Exception | (See the provider documentation for specific exceptions.) |
ExecuteNonQueryAsync()
Executes Command
Declaration
public Task<int> ExecuteNonQueryAsync()
Returns
| Type | Description |
|---|---|
| Task<Int32> | A |
ExecuteReader()
Executes Command
Declaration
public DbDataReader ExecuteReader()
Returns
| Type | Description |
|---|---|
| Db |
A |
Exceptions
| Type | Condition |
|---|---|
| Exception | (See the provider documentation for specific exceptions.) |
ExecuteReader(CommandBehavior)
Executes Command
Declaration
public DbDataReader ExecuteReader(CommandBehavior commandBehavior)
Parameters
| Type | Name | Description |
|---|---|---|
| Command |
commandBehavior | The command behavior. |
Returns
| Type | Description |
|---|---|
| Db |
A |
Exceptions
| Type | Condition |
|---|---|
| Exception | (See the provider documentation for specific exceptions.) |
ExecuteReaderAsync()
Executes Command
Declaration
public Task<DbDataReader> ExecuteReaderAsync()
Returns
| Type | Description |
|---|---|
| Task<Db |
A |
ExecuteReaderAsync(CommandBehavior)
Executes Command
Declaration
public Task<DbDataReader> ExecuteReaderAsync(CommandBehavior commandBehavior)
Parameters
| Type | Name | Description |
|---|---|---|
| Command |
commandBehavior | The command behavior. |
Returns
| Type | Description |
|---|---|
| Task<Db |
A |
ExecuteScalar()
Executes Command
Declaration
public object ExecuteScalar()
Returns
| Type | Description |
|---|---|
| Object | The first column of the first row in the result set returned by the query. All other columns and rows are ignored. |
Exceptions
| Type | Condition |
|---|---|
| Exception | (See the provider documentation for specific exceptions.) |
ExecuteScalarAsync()
Executes Command
Declaration
public Task<object> ExecuteScalarAsync()
Returns
| Type | Description |
|---|---|
| Task<Object> | A |
Prepare()
Creates a prepared (or compiled) version of the command on the data source.
Declaration
public void Prepare()