CreateCommand for OLEDB
- Last UpdatedNov 25, 2015
- 1 minute read
The parameters are identified in the SQL statement by the question mark (?) character and no name when ProviderType is OLEDB.
"SELECT * FROM Person.Contact WHERE (LastName > ?)"
In this case, you configure the parameters by index and not by name.
Be aware that you cannot mix configuration parameters by index and by name.
Return Value
If a failure occurs, this method returns null.
Getting the ExecutionState property of the newly-created command object returns Created.
Parameters
CommandText
One of the following:
SQL Statement
Stored Procedure name
CommandType
Specifies how the SQL statement is handled:
sqlStatement
storedProcedure
ReturnDataset
Boolean, indicates if the command object is to return a dataset
If True, you want a data table to be returned. For example:
sqlStatement ="SELECT * FROM Person.Contact"
If False, you want to modify only the database or get the Output or ReturnValue parameter. Examples are INSERT, DELETE, and UPDATE SQL statements.
The data that is returned upon successful execution of a query (Table, View or StoredProcedure) is stored in memory. Scalar values are not returned, other than by being part of the returned dataset.
You can then access this data by using the interface provided by the aaDBCommand object.