Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - .NET Programming » UltraLite .NET 1.0 API Reference

ULAuthStatusCode enumeration Next Page

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.

Syntax

Visual Basic

NotInheritable Public Class ULCommand
Inherits Component

C#

public sealed class ULCommand :
Component

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.ExecuteNonQueryExecutes 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.ExecuteScalarExecutes 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.

Implements: System.Data.IDbCommand, System.IDisposable

See also

ULCommand members
ULCommand constructor
ULCommand constructor
ULCommand constructor
ULCommand constructor
CommandText property
CommandTimeout property
CommandType property
Connection property
DesignTimeVisible property
IndexName property
Parameters property
Plan property
Transaction property
UpdatedRowSource property
Cancel method
CreateParameter method
ExecuteNonQuery method
ExecuteReader method
ExecuteReader method
ExecuteResultSet method
ExecuteResultSet method
ExecuteScalar method
ExecuteTable method
ExecuteTable method
Prepare method