|
<< Click to Display Table of Contents >> Executing queries directly |
![]() ![]()
|
Use DbiQExecDirec for simple queries, where no special preparation is necessary. This function immediately prepares and executes a SQL or QBE query and returns a cursor to the result set, if one is generated. The application passes the database handle, specifies whether the query language is QBE or SQL, and passes the formulated query string.
With SQL query language, if the specified database handle refers to a server database, the SQL dialect native to that server is expected. If the database handle refers to a standard database, the SQL statement is limited to the subset supported by the common query engine.
The following example shows how a SQL query is executed with the function DbiQExecDirect:
DBIResult rslt;
hDBICur hCur;
pBYTE szQuery = "SELECT t.name, t.age "
"FROM Employee t "
"WHERE (t.age > 30) AND "
" (t.salary > 1000000)";
rslt = DbiQExecDirect(hDb, qrylangSQL, szQuery, &hCur);