JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the OleDbCommand Class

The OleDbCommand class represents a SQL statement or stored procedure that is executed in a database by an OLE DB data provider. Here is the inheritance hierarchy of this class:

Object
   MarshalByRefObject
      Component
         OleDbCommand

You can find the more notable public properties of OleDbCommand objects in Table 22.7 and their more notable methods in Table 22.8. (This class has no noninherited events.)

Table 22.7: Noteworthy public properties of OleDbCommand objects.

Property

Means

CommandText

Gets/sets the SQL statement (or stored procedure) for this command to execute.

CommandTimeout

Gets the amount of time to wait trying to execute a command.

CommandType

Gets/sets the type of the CommandText property (typically set to text for SQL).

Connection

Gets/sets the OleDbConnection to use.

DesignTimeVisible

Gets/sets if the command object should be visible in a form designer.

Parameters

Gets the command parameters.

Transaction

Gets/sets the transaction that contains the command.

UpdatedRowSource

Gets/sets how results are used in a data row when you use the Update method.

Table 22.8: Noteworthy public methods of OleDbCommand objects.

Method

Means

Cancel

Cancels a command's execution.

CreateParameter

Creates a new parameter.

ExecuteNonQuery

Executes a non-row returning SQL statement, returning the number of affected rows.

ExecuteReader

Creates a data reader using the command.

ExecuteScalar

Executes the command and returns the value in the first column in the first row of the result.

Prepare

Creates a compiled version of the command.

ResetCommandTimeout

Resets the timeout value to the default value.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor