This will execute an SQL statement against an underlying data source


Function Execute( command, hints, result )


string command  - the SQL statement to execute

variant hints  - execution hint(s) (optional):

"true" or "ignore" - to ignore any errors

"norep" - not to replace invalid characters in the statement

array result - the execution result (optional)

Return Values

variant the result of the execution as follows:

Empty - if no records were returned, or all the field values are NULL

A scalar value - the result of an UPDATE SQL operation, or the record ID of a new record created by an INSERT operation

A single Array - when only one field was requested. When only a single record is returned, it will be an array with a single item in it.

An Array which contains another Arrays - the outer array represents fields, the inner arrays contain values for each fields.


To populate an array by a record's values:

Dim fields

this.DS.Execute "SELECT TOP 1 * FROM MyTable", fields

fields now is an array filled with values from the record's fields.

Get a scalar result of an execution:

Dim count

count = this.DS.Execute( "UPDATE Employees SET Salary=65000 WHERE Age > 45" )

count now contains the number of affected records

See also