Specifying Commands
Commands are set, through Command objects, with two properties. The
first of these properties, CommandText, holds either the String value
representing the command’s text or the name of a stored command
text as the data provider references it. In other words, either the
SQL statement SELECT
*
FROM
Authors; can be assigned
to the CommandText property, or this string can be stored in the data
source and referenced, through the data provider, by a name such as
“Get All From Authors”. The CommandType property tells
ADO what kind of value resides in the CommandText property. This
property would indicate if the value within the CommandText property
was a SQL statement or a name of a stored SQL
statement. The value of the CommandType property can be set to any
valid
CommandTypeEnum values as shown in Table 7-1.
Table 7-1. The CommandTypeEnum Enumeration
|
Value |
Description |
|---|---|
adCmdText |
Indicates that the value of the CommandText property is a definition of a command that the data provider will understand. |
adCmdTable |
Indicates that the value of the CommandText property is the name of a table within the data source. ADO will create a SQL statement from the table name specified to return all fields within the table. |
adCmdTableDirect |
Indicates that the value of the CommandText property is the name of a table within the data source. This value is very similar to that of adCmdFile except that the table name is used to return all of the fields within the table rather than ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access