To execute a SQL statement in an ODBC application, allocate a handle for the statement using SQLAllocHandle and then call the SQLExecDirect function to execute the statement. Any parameters must be included as part of the statement (for example, a WHERE clause must specify its arguments). For a more flexible method of constructing statements, see Executing statements with bound parameters.
The SQLExecDirect function takes a statement handle, a SQL string, and a length or termination indicator, which in this case is a null-terminated string indicator. The statement may include parameters.
For more information about SQLExecDirect, see the Microsoft ODBC API Reference at http://msdn.microsoft.com/en-us/library/ms713611.aspx.
For a complete sample with error checking, see %SQLANYSAMP16%\SQLAnywhere\ODBCExecute\odbcexecute.cpp.
Discuss this page in DocCommentXchange.
|Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0|