ULCommand class

Represents a pre-compiled SQL statement or query, with or without IN parameters. This object can be used to execute a statement or query efficiently multiple times. This class cannot be inherited.

Syntax
Visual Basic

Public NotInheritable Class ULCommand 
  Inherits DbCommand
  Implements ICloneable
C#

public sealed class ULCommand : DbCommand,
  ICloneable
Remarks

ULCommand objects can be created directly, or with the ULConnection.CreateCommand method. This method ensures that the command has the correct transaction for executing statements on the given connection.

The ULCommand.Transaction method must be reset after the current transaction is committed or rolled back.

ULCommand features the following methods for executing commands on an UltraLite.NET database:

Method

Description

ULCommand.ExecuteNonQuery Executes a statement that does not return a result set, such as a SQL INSERT, DELETE, or UPDATE statement.
ULCommand.ExecuteReader() Executes a SQL SELECT statement and returns the result set in a ULDataReader. Use this method for creating read-only result sets.
ULCommand.ExecuteResultSet() UL Ext.: Executes a SQL SELECT statement and returns the result set in a ULResultSet. Use this method for creating mutable result sets.
ULCommand.ExecuteScalar Executes a SQL SELECT statement and returns a single value.
ULCommand.ExecuteTable() UL Ext.: Retrieves a database table in a ULTable for direct manipulation. The ULCommand.CommandText is interpreted as the name of the table and the ULCommand.IndexName can be used to specify a table sorting order. The ULCommand.CommandType must be System.Data.CommandType.TableDirect.

You can reset most properties, including the ULCommand.CommandText, and reuse the ULCommand object.

For resource management reasons, it is recommended that you explicitly dispose of commands when you are done with them. In C#, you may use a using statement to automatically call the System.ComponentModel.Component.Dispose() method or explicitly call the System.ComponentModel.Component.Dispose() method. In Visual Basic, you always explicitly call the System.ComponentModel.Component.Dispose() method.

Inherits: System.Data.Common.DbCommand

Implements: System.Data.IDbCommand, System.IDisposable

See also

ULCommand members
ULCommand constructors
CommandText property
CommandTimeout property
CommandType property
Connection property
DesignTimeVisible property
IndexName property
Parameters property
Plan property
Transaction property
UpdatedRowSource property
BeginExecuteNonQuery methods
BeginExecuteReader methods
Cancel method
CreateParameter method
EndExecuteNonQuery method
EndExecuteReader method
ExecuteNonQuery method
ExecuteReader methods
ExecuteResultSet methods
ExecuteScalar method
ExecuteTable methods
Prepare method