9. Understanding .NET Data Provider Connectivity : .NET Data Provider Classes : IngresCommand Class
 
Share this page                  
IngresCommand Class
The IngresCommand class represents an SQL command or a database procedure that executes against an Ingres or Enterprise Access database.
Parameter placeholders in the SQL command text are represented by a question mark (?).
Database procedures can be invoked by either setting CommandText=”myproc” and CommandType=CommandType.StoredProcedure, or by using the escape sequence format and setting CommandText=”{ call myproc }” and CommandType=CommandType.Text.
The .NET Data Provider does not currently support the following features:
Multiple active results-sets
Batched commands consisting of multiple Ingres SQL commands in one IngresCommand object
Support for Ingres SQL command COPY TABLE
Support for Ingres SQL command SAVEPOINT
IngresCommand.ExecuteReader(CommandBehavior.SchemaOnly) is supported for SELECT commands only
IngresCommand Class Declaration
The IngresCommand class declarations are:
C#: public sealed class IngresCommand : System.Data.Common.DbCommand, IDbCommand, IDisposable, ICloneable
VB.NET: NotInheritable Public Class IngresCommand
Inherits System.Data.Common.DbCommand
Implements IDbCommand, IDisposable, ICloneable
IngresCommand Class Example
IngresCommand cmd = new IngresCommand(
“SELECT id, name FROM employee WHERE id = ?”);
IngresCommand Class Properties
The IngresCommand class properties are:
Property
Accessor
Description
CommandText
get set
SQL statement string to execute or procedure name to call.
CommandTimeout
get set
The time, in seconds, for an attempted query to time-out if the query has not yet completed. Default is 0 seconds.
CommandType
get set
An enumeration describing how to interpret the CommandText property. Valid values are Text, TableDirect, or StoredProcedure.
Connection
get set
The IngresConnection object that is used to identify the connection to execute a command. For more information, see IngresConnection Class.
Parameters
get
The IngresParameterCollection for the parameters associated with the SQL query or database procedure. For more information, see IngresParameterCollection Class.
Transaction
get set
The IngresTransaction object in which the IngresCommand executes. This transaction object must be compatible with the transaction object that is associated with the Connection, (that is, the IngresTransaction must be the object (or a copy) returned by IngresConnection.BeginTransaction).
UpdateRowSource
get set
Defines how results are applied to a rowset by the DbDataAdapter.Update method. (Inherited from DbDataAdapter.)
IngresCommand Class Public Methods
The public methods for the IngresCommand class are:
Method
Description
Cancel
Cancels the execution of the SQL command or database procedure.
CreateParameter
Creates a new instance of IngresParameter. For more information, see IngresParameter Class.
Dispose
Releases allocated resources of the IngresCommand and base Component.
ExecuteNonQuery
Executes a command that does not return results. Returns the number of rows affected by the update, delete, or insert SQL command.
ExecuteReader
Executes a command and builds an IngresDataReader. For more information, see  IngresDataReader Class.
ExecuteScalar
Executes a command and returns the first column of the first row of the result set.
Prepare
Prepares the SQL statement to be executed later.
ResetCommandTimeout
Resets the CommandTimeout property to its default value of 30 seconds.
IngresCommand Class Constructors
The constructors for the IngresCommand class are:
Constructor Overloads
Description
IngresCommand()
Instantiates a new instance of the IngresCommand class using default property values
IngresCommand(string)
Instantiates a new instance of the IngresCommand class using the defined SQL command or database procedure
IngresCommand(string, IngresConnection)
Instantiates a new instance of the IngresCommand class using the defined SQL command or database procedure and the connection to the Ingres, Vector, or Enterprise Access database
IngresCommand(string, IngresConnection, IngresTransaction)
Instantiates a new instance of the IngresCommand class using the defined SQL command or database procedure, the connection to the Ingres, Vector, or Enterprise Access database, and the IngresTransaction object