Class SoCommand
Implements the IDbCommand.
Inherited Members
Namespace: SuperOffice.Data
Assembly: SoDataBase.dll
Syntax
public sealed class SoCommand : IDbCommand, IDisposable
Properties
Connection
Connection to be used for execution of this command
Declaration
public SoConnection Connection { get; set; }
Property Value
Type | Description |
---|---|
SoConnection |
IsAutoSentry
Does this command use the AutoSentry system, where sentries are automatically created based on an analysis of the command
Declaration
public bool IsAutoSentry { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsDefaultTransaction
Flag indicating whether the Transaction property is an internally-generated default transaction. If false, then the transaction was created by the calling code and is that code's responsibility.
Declaration
public bool IsDefaultTransaction { get; }
Property Value
Type | Description |
---|---|
bool |
Sentries
Collection of Sentries relevant to the execution of this command
Declaration
public SentryCollection Sentries { get; }
Property Value
Type | Description |
---|---|
SentryCollection |
SqlCommand
The sql command to be processed
Declaration
public SqlCommand SqlCommand { get; set; }
Property Value
Type | Description |
---|---|
SqlCommand |
Transaction
Transaction that this command will be a member of
Declaration
public SoTransaction Transaction { get; set; }
Property Value
Type | Description |
---|---|
SoTransaction |
UpdatedRowSource
Implements the IDbCommand.
Declaration
public UpdateRowSource UpdatedRowSource { get; set; }
Property Value
Type | Description |
---|---|
UpdateRowSource |
Methods
Cancel()
Attempts to cancels the execution of an IDbCommand.
Declaration
public void Cancel()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
ExecuteNonQuery()
Executes an SQL statement against the Connection object of a .NET Framework data provider, and returns the number of rows affected.
Declaration
public int ExecuteNonQuery()
Returns
Type | Description |
---|---|
int | The number of rows affected. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The connection does not exist.-or- The connection is not open. |
ExecuteReader()
Execute the CommandText on the Connection, create an SoDataReader to read the results, and return it. The reader will start on row 1 and go through the whole result set.
Declaration
public SoDataReader ExecuteReader()
Returns
Type | Description |
---|---|
SoDataReader | SoDataReader, which implements the IDataReader interface as well as SuperOffice functionality |
ExecuteReader(CommandBehavior)
Execute the CommandText on the Connection, create an SoDataReader to read the results, and return it. The reader will start on row 1 and go through the whole result set.
Declaration
public SoDataReader ExecuteReader(CommandBehavior behaviour)
Parameters
Type | Name | Description |
---|---|---|
CommandBehavior | behaviour | Command behaviour, passed through to the underlying ADO.NET provider |
Returns
Type | Description |
---|---|
SoDataReader | SoDataReader, which implements the IDataReader interface as well as SuperOffice functionality |
ExecuteReader(CommandBehavior, int, int)
Execute the CommandText on the Connection, create an SoDataReader to read the results, and return it. The reader will return one page of records, as defined by the page size and starting point.
Declaration
public SoDataReader ExecuteReader(CommandBehavior behaviour, int pageSize, int pageWanted)
Parameters
Type | Name | Description |
---|---|---|
CommandBehavior | behaviour | Command behaviour, passed through to the underlying ADO.NET provider |
int | pageSize | Number of records per page; only one page will be returned by the reader |
int | pageWanted | Desired page, starting at 0. |
Returns
Type | Description |
---|---|
SoDataReader | SoDataReader, which implements the IDataReader interface as well as SuperOffice functionality |
ExecuteReader(int, int)
Execute the CommandText on the Connection, create an SoDataReader to read the results, and return it. The reader will return one page of records, as defined by the page size and starting point.
Declaration
public SoDataReader ExecuteReader(int pageSize, int pageWanted)
Parameters
Type | Name | Description |
---|---|---|
int | pageSize | Number of records per page; only one page will be returned by the reader |
int | pageWanted | Desired page, starting at 0. |
Returns
Type | Description |
---|---|
SoDataReader | SoDataReader, which implements the IDataReader interface as well as SuperOffice functionality |
ExecuteScalar()
Executes the query, and returns the first column of the first row in the resultset returned by the query. Extra columns or rows are ignored.
Declaration
public object ExecuteScalar()
Returns
Type | Description |
---|---|
object | The first column of the first row in the resultset. |
LogNonQuery(TimeSpan, int, string)
Implements the IDbCommand.
Declaration
public void LogNonQuery(TimeSpan executionTime, int rowsAffected, string exceptionMessage)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | executionTime | |
int | rowsAffected | |
string | exceptionMessage |
LogQueryReader(TimeSpan, int, string)
Implements the IDbCommand.
Declaration
public void LogQueryReader(TimeSpan executionTime, int rowsAffected, string exceptionMessage)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | executionTime | |
int | rowsAffected | |
string | exceptionMessage |
LogQueryScalar(TimeSpan, int, string)
Implements the IDbCommand.
Declaration
public void LogQueryScalar(TimeSpan executionTime, int rowsAffected, string exceptionMessage)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | executionTime | |
int | rowsAffected | |
string | exceptionMessage |
Prepare()
Creates a prepared (or compiled) version of the command on the data source.
Declaration
public void Prepare()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Connection is not set.-or- The Connection is not System.Data.OleDb.OleDbConnection.Open. |