DatabaseQuery()
Syntax
Result = DatabaseQuery(#Database, Request$)Description
Executes an SQL query on the given database.
Parameters
#Database The database to use. Request$ The query to execute.
Return value
Returns nonzero if the query was successful or zero if it failed (due to a SQL error or a badly-formatted query).
Remarks
If the query has succeeded then NextDatabaseRow() can be used to list returned records (see the example below). In the event of an error, the error text can be retrieved with DatabaseError(). It is safe to use NextDatabaseRow() even if the request doesn't return any records. To execute a request that doesn't return any records, use DatabaseUpdate() instead of DatabaseQuery().
Once the query results aren't needed anymore, FinishDatabaseQuery() has to be called to release all the query resources.
Example
; First, connect to a database with an employee table
;
If DatabaseQuery(#Database, "SELECT * FROM employee") ; Get all the records in the 'employee' table
While NextDatabaseRow(#Database) ; Loop for each records
Debug GetDatabaseString(#Database, 0) ; Display the content of the first field
Wend
FinishDatabaseQuery(#Database)
EndIf
See Also
DatabaseUpdate(), NextDatabaseRow()
Supported OS
All